Skip to content

Commit

Permalink
Merge branch 'release/0.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
a-vogel committed Sep 17, 2024
2 parents fb316f3 + 890709d commit c7f0d0a
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 26 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion misty/build-info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>suppress_bundle_relocation</key>
<true/>
<key>version</key>
<string>0.2.1</string>
<string>0.2.2</string>
</dict>
</plist>
46 changes: 23 additions & 23 deletions misty/payload/usr/local/wycomco/misty
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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"

Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion misty/payload/var/root/misty/skel/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions misty/scripts/postinstall
Original file line number Diff line number Diff line change
@@ -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\"' 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

if [ ! -L "/usr/local/bin/misty" ]; then
ln -s "/usr/local/wycomco/misty" "/usr/local/bin/misty"
fi
Expand Down

0 comments on commit c7f0d0a

Please sign in to comment.