diff --git a/fragments/functions.sh b/fragments/functions.sh index b1ba7a0..02a5f86 100644 --- a/fragments/functions.sh +++ b/fragments/functions.sh @@ -345,16 +345,6 @@ installAppWithPath() { # $1: path to app to install in $targetDir cleanupAndExit 5 "Team IDs do not match" fi - # macOS versioncheck - minimumOSversion=$(defaults read $appPath/Contents/Info.plist LSMinimumSystemVersion) - if [[ $minimumOSversion =~ '[0-9.]*' ]]; then - printlog "App has LSMinimumSystemVersion: $minimumOSversion" - if ! is-at-least $minimumOSversion $installedOSversion; then - printlog "App requires higher System Version than installed: $installedOSversion" - cleanupAndExit 6 "Installed macOS is too old for this app." - fi - fi - # app versioncheck appNewVersion=$(defaults read $appPath/Contents/Info.plist $versionKey) if [[ -n $appNewVersion && $appversion == $appNewVersion ]]; then @@ -373,6 +363,21 @@ installAppWithPath() { # $1: path to app to install in $targetDir printlog "Downloaded version of $name is $appNewVersion (replacing version $appversion)." fi + # macOS versioncheck + minimumOSversion=$(defaults read $appPath/Contents/Info.plist LSMinimumSystemVersion) + if [[ $minimumOSversion =~ '[0-9.]*' ]]; then + printlog "App has LSMinimumSystemVersion: $minimumOSversion" + if ! is-at-least $minimumOSversion $installedOSversion; then + printlog "App requires higher System Version than installed: $installedOSversion" + message="Cannot install $name, version $appNewVersion, as it is not compatible with the running system version." + if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then + printlog "notifying" + displaynotification "$message" "Error updating $name!" + fi + cleanupAndExit 6 "Installed macOS is too old for this app." + fi + fi + # skip install for DEBUG 1 if [ "$DEBUG" -eq 1 ]; then printlog "DEBUG mode 1 enabled, skipping remove, copy and chown steps"