diff --git a/CHANGELOG.md b/CHANGELOG.md index e3bbfa7..67b74f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## v9? - We have moved the root check to the beginning of the script, and improved DEBUG handling with two different modes. `DEBUG=0` is still for production, and `1` is still for the DEBUG we previously knew downloading to the directory it is running from, but `2` will download to temporary folder, will detect updates, but will not install anything, but it will notify the user (almost as running the script without root before). +- `LSMinimumSystemVersion` will now be honered, if the `Info.plist` in the app is specifying this. That means that an app that has this parameter in that file and it shows that the app requires a newer version of the OS than is currently installed, then we will not install it. - New variable `RETURN_LABEL_NAME`. If given the value `1`, like `RETURN_LABEL_NAME=1` then Installomator only returns the name of the label. It makes for a better user friendly message for displaying in DEPNotify if that is integrated. - Changed logic if `IGNORE_APP_STORE_APPS=yes`. Before this version a label like `microsoftonedrive` that was installed from App Store, and that we want to replace with the “ordinary” version, Installomator would still use `updateTool`, even though `IGNORE_APP_STORE_APPS=yes`. So we would have to have `INSTALL=force` in order to have the app replaced, as `updateTool` would be used. But now if `IGNORE_APP_STORE_APPS=yes` then `updateTool` will be not set, and the App Store app will be replaced. BUT if the installed software was not from App Store, then `updateTool` will not be used, and it would be a kind of a forced install (in the example of `microsoftonedrive`), except if the version is the same (where installation is skipped). - Added variable `SYSTEMOWNER` that is used when copying files when installing. Default `0` is to change owner of the app to the current user on the Mac, like this user was installing this app themselves. When using `1` we will put “root:wheel” on the app, which can be useful for shared machines. 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 9d687bd..658be62 100644 --- a/fragments/functions.sh +++ b/fragments/functions.sh @@ -349,8 +349,7 @@ installAppWithPath() { # $1: path to app to install in $targetDir cleanupAndExit 5 "Team IDs do not match" fi - # versioncheck - # credit: Søren Theilgaard (@theilgaard) + # 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." @@ -368,6 +367,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"