From 5f4b6197fb09a27b3d6727cceb97aad383958121 Mon Sep 17 00:00:00 2001 From: a-vogel Date: Mon, 16 Sep 2024 15:39:29 +0200 Subject: [PATCH 1/3] Sequoia changes, update cfg in postinstall --- misty/payload/usr/local/wycomco/misty | 46 ++++++++++---------- misty/payload/var/root/misty/skel/config.txt | 2 +- misty/scripts/postinstall | 20 +++++++++ 3 files changed, 44 insertions(+), 24 deletions(-) diff --git a/misty/payload/usr/local/wycomco/misty b/misty/payload/usr/local/wycomco/misty index ef2d056..942a6ce 100755 --- a/misty/payload/usr/local/wycomco/misty +++ b/misty/payload/usr/local/wycomco/misty @@ -519,9 +519,9 @@ echo "RepoName: $RepoName" > /dev/null echo "munki_path: $munki_path" > /dev/null echo "munki_name: $munki_name" > /dev/null echo "deploy_name: $deploy_name" > /dev/null -echo "munki_catalog_12: $munki_catalog_12" > /dev/null echo "munki_catalog_13: $munki_catalog_13" > /dev/null echo "munki_catalog_14: $munki_catalog_14" > /dev/null +echo "munki_catalog_15: $munki_catalog_15" > /dev/null echo "munki_category: $munki_category" > /dev/null echo "time_input: $time_input" > /dev/null echo "localization: $localization" > /dev/null @@ -561,17 +561,25 @@ fi ################################################################################ # We want to check each major version seperately +mist list installer 15 --latest | grep GB > "$LogPath/tmp_state_15.txt" mist list installer 14 --latest | grep GB > "$LogPath/tmp_state_14.txt" mist list installer 13 --latest | grep GB > "$LogPath/tmp_state_13.txt" -mist list installer 12 --latest | grep GB > "$LogPath/tmp_state_12.txt" # Remove color codes resulting from grep and clean up +rm_color_codes "$LogPath/tmp_state_15.txt" > "$LogPath/current_state_15.txt" rm_color_codes "$LogPath/tmp_state_14.txt" > "$LogPath/current_state_14.txt" rm_color_codes "$LogPath/tmp_state_13.txt" > "$LogPath/current_state_13.txt" -rm_color_codes "$LogPath/tmp_state_12.txt" > "$LogPath/current_state_12.txt" /bin/rm -f "$LogPath/tmp_state_*.txt" # Compare the content with the previous state if present, ignoring last two columns (date and compatibliity) +if [ -f "$LogPath/previous_state_15.txt" ]; then + if ! awk '{ for(i=2;i<=NF-4;i++) printf "%s ", $i; print "" }' "$LogPath/current_state_15.txt" | cmp -s - <(awk '{ for(i=2;i<=NF-4;i++) printf "%s ", $i; print "" }' "$LogPath/previous_state_15.txt"); then + macos_15=$(extract_macos_version Sequoia "$LogPath/current_state_15.txt") + fi +else + macos_15=$(extract_macos_version Sequoia "$LogPath/current_state_15.txt") +fi + if [ -f "$LogPath/previous_state_14.txt" ]; then if ! awk '{ for(i=2;i<=NF-4;i++) printf "%s ", $i; print "" }' "$LogPath/current_state_14.txt" | cmp -s - <(awk '{ for(i=2;i<=NF-4;i++) printf "%s ", $i; print "" }' "$LogPath/previous_state_14.txt"); then macos_14=$(extract_macos_version Sonoma "$LogPath/current_state_14.txt") @@ -588,14 +596,6 @@ else macos_13=$(extract_macos_version Ventura "$LogPath/current_state_13.txt") fi -if [ -f "$LogPath/previous_state_12.txt" ]; then - if ! awk '{ for(i=2;i<=NF-4;i++) printf "%s ", $i; print "" }' "$LogPath/current_state_12.txt" | cmp -s - <(awk '{ for(i=2;i<=NF-4;i++) printf "%s ", $i; print "" }' "$LogPath/previous_state_12.txt"); then - macos_12=$(extract_macos_version Monterey "$LogPath/current_state_12.txt") - fi -else - macos_12=$(extract_macos_version Monterey "$LogPath/current_state_12.txt") -fi - # Clean up tmp files rm -rf "$LogPath/tmp_state_*.txt" @@ -604,6 +604,17 @@ rm -rf "$LogPath/tmp_state_*.txt" ################################################################################ # Execute loops only if version has changed +if [ -n "$macos_15" ]; then + fqos=$macos_15 + munki_catalog=$munki_catalog_15 + munki_mini=6.6.1 + os_major="15" + os_maxi="14.99" + os_mini="10.13" + os_munki="sequoia" + os_nice="Sequoia" + repo_stuff +fi if [ -n "$macos_14" ]; then fqos=$macos_14 munki_catalog=$munki_catalog_14 @@ -626,24 +637,13 @@ if [ -n "$macos_13" ]; then os_nice="Ventura" repo_stuff fi -if [ -n "$macos_12" ]; then - fqos=$macos_12 - munki_catalog=$munki_catalog_12 - munki_mini=6.0.1 - os_major="12" - os_maxi="11.99" - os_mini="10.9" - os_munki="monterey" - os_nice="Monterey" - repo_stuff -fi ################################################################################ # Postinstall, makecatalogs # ################################################################################ # Check if any new package(s) were created -if [[ ( -n "$macos_12" || -n "$macos_13" || -n "$macos_14" ) ]]; then +if [[ ( -n "$macos_13" || -n "$macos_14" || -n "$macos_15" ) ]]; then if [[ -f "$Base_Path/usr/postinstall.sh" ]]; then "$Base_Path/usr/postinstall.sh" fi diff --git a/misty/payload/var/root/misty/skel/config.txt b/misty/payload/var/root/misty/skel/config.txt index 3dd3ed8..0313c57 100644 --- a/misty/payload/var/root/misty/skel/config.txt +++ b/misty/payload/var/root/misty/skel/config.txt @@ -12,9 +12,9 @@ munki_name="macos" # munki name used for provisioning scenarios deploy_name="deploy_macos" # Please specify the munki catalog(s) for the respective versions -munki_catalog_12="testing" munki_catalog_13="testing" munki_catalog_14="testing" +munki_catalog_15="testing" # Please specify the munki category munki_category="Utilities" # If turned to "yes", localizations will be used. If not present yet, copy the files starting with "localized_" from the skel/ dir into the usr/ folder and adjust to your needs diff --git a/misty/scripts/postinstall b/misty/scripts/postinstall index def961e..7ee75b8 100755 --- a/misty/scripts/postinstall +++ b/misty/scripts/postinstall @@ -1,5 +1,25 @@ #!/bin/zsh +config_file="/var/root/misty/usr/config.txt" +currentUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ { print $3 }' ) +log_file="/var/log/misty.log" + +# Check if config file already exists +if [[ -f "$config_file" ]]; then + if grep -q '^munki_catalog_12="' "$config_file"; then + sed -i '' '/^munki_catalog_12="/d' "$config_file" + echo "Removed 'munki_catalog_12' line in $config_file by installer." >> "$log_file" + fi + if ! grep -q '^munki_catalog_15="' "$config_file"; then + # Add the 'munki_catalog_15="testing"' line after any line that starts with 'munki_catalog_14="' + sed -i '' '/^munki_catalog_14="/a\ +munki_catalog_15="testing" +' "$config_file" + echo "Added 'munki_catalog_15=\"testing\"' after 'munki_catalog_14' by installer." >> "$log_file" + sudo -u "$currentUser" osascript -e 'tell app "System Events" to display dialog "Added munki_catalog_15=\"testing\" after munki_catalog_14 by installer."' + fi +fi + if [ ! -L "/usr/local/bin/misty" ]; then ln -s "/usr/local/wycomco/misty" "/usr/local/bin/misty" fi From 271502ec2945a2f2511e36dd66492bc2e9214fe6 Mon Sep 17 00:00:00 2001 From: a-vogel Date: Mon, 16 Sep 2024 16:22:44 +0200 Subject: [PATCH 2/3] Display location of changes --- misty/scripts/postinstall | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misty/scripts/postinstall b/misty/scripts/postinstall index 7ee75b8..0ed355e 100755 --- a/misty/scripts/postinstall +++ b/misty/scripts/postinstall @@ -15,8 +15,8 @@ if [[ -f "$config_file" ]]; then sed -i '' '/^munki_catalog_14="/a\ munki_catalog_15="testing" ' "$config_file" - echo "Added 'munki_catalog_15=\"testing\"' after 'munki_catalog_14' by installer." >> "$log_file" - sudo -u "$currentUser" osascript -e 'tell app "System Events" to display dialog "Added munki_catalog_15=\"testing\" after munki_catalog_14 by installer."' + echo "Added 'munki_catalog_15=\"testing\"' line after 'munki_catalog_14' in $config_file by installer." >> "$log_file" + sudo -u "$currentUser" osascript -e 'tell app "System Events" to display dialog "Added munki_catalog_15=\"testing\" line after munki_catalog_14 in $config_file by installer."' fi fi From 890709d495aa212d47a067fd0bcd7c60ea660ad7 Mon Sep 17 00:00:00 2001 From: a-vogel Date: Tue, 17 Sep 2024 14:17:37 +0200 Subject: [PATCH 3/3] Set new release 0.2.2, documentation --- CHANGELOG.md | 6 ++++++ README.md | 3 ++- misty/build-info.plist | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 521dc15..b5431ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ - See [Testing methods](./README.md#testing-methods) and [To Do](./README.md#to-do) sections of the README if you plan to use *misty* at the current state. +## [0.2.2](https://github.com/wycomco/misty/releases/tag/v0.2.2) – 2024-09-17 (Pre-release) + +### Added +- Add support for macOS Sequoia, remove macOS Monterey routine; update config.txt if present – [PR#15](https://github.com/wycomco/misty/pull/15) + + ## [0.2.1](https://github.com/wycomco/misty/releases/tag/v0.2.1) – 2024-09-04 (Pre-release) ### Security diff --git a/README.md b/README.md index bc03925..de7dcdc 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,8 @@ This is a pre-release. It is working, but we have some tasks on our to-do list: - Testing in different environments, preferably with SMB and Samba shares. - Ensure all items that require FDA are mentioned. -- Check for available space. We need to check the space on the munki repo, but more importantly, the space on the system disk. If not enough space is available, the resulting installer .app will not be complete, resulting in unusable plists and payloads being offered to clients. There exists a check with hard-coded values that stops the import process for each major version, but more testing needs to be done to ensure the values are appropriate. +- Calculate space requirements based on actual number of available macOS versions +- Function `rm_previous_files` states one previous version when no version is available - Improve message output. - Harmonize variable names. - Improve code readability in general. diff --git a/misty/build-info.plist b/misty/build-info.plist index c122587..c44bf02 100644 --- a/misty/build-info.plist +++ b/misty/build-info.plist @@ -19,6 +19,6 @@ suppress_bundle_relocation version - 0.2.1 + 0.2.2