diff --git a/fragments/arguments.sh b/fragments/arguments.sh index d682862..6c01519 100644 --- a/fragments/arguments.sh +++ b/fragments/arguments.sh @@ -1,7 +1,8 @@ # MARK: check minimal macOS requirement autoload is-at-least -if ! is-at-least 10.14 $(sw_vers -productVersion); then +installedOSversion=$(sw_vers -productVersion) +if ! is-at-least 10.14 $installedOSversion; then printlog "Installomator requires at least macOS 10.14 Mojave." exit 98 fi diff --git a/fragments/functions.sh b/fragments/functions.sh index f5d5137..b1ba7a0 100644 --- a/fragments/functions.sh +++ b/fragments/functions.sh @@ -345,8 +345,17 @@ installAppWithPath() { # $1: path to app to install in $targetDir cleanupAndExit 5 "Team IDs do not match" fi - # versioncheck - # credit: Søren Theilgaard (@theilgaard) + # 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 printlog "Downloaded version of $name is $appNewVersion, same as installed."