6 Commits

Author SHA1 Message Date
Søren Theilgaard
dbb027399e Merge branch 'Variable-for-skipping-if-app-is-not-installed' of https://github.com/Installomator/Installomator into Variable-for-skipping-if-app-is-not-installed 2022-03-03 21:42:05 +01:00
Søren Theilgaard
f5db340589 Update functions.sh 2022-03-03 21:41:48 +01:00
Søren Theilgaard
31e376789f Update CHANGELOG.md 2022-03-03 21:38:02 +01:00
Søren Theilgaard
c049dc4a92 Update CHANGELOG.md 2022-03-03 16:27:16 +01:00
Søren Theilgaard
e5541fb97a Merge branch 'main' into Variable-for-skipping-if-app-is-not-installed 2022-03-03 16:25:53 +01:00
Søren Theilgaard
4cee224d17 Variable SKIP_UNINSTALLED introduced
Fixes #321.
2022-02-08 13:46:05 +01:00
4 changed files with 19 additions and 3 deletions

View File

@@ -1,3 +1,7 @@
## v10.0
- Introducing variable `SKIP_UNINSTALLED` that normally will be `0` and the script will run and install the software label if other conditions align with this. Use `SKIP_UNINSTALLED=1` to have the script stop if a current installation of the app is not found.
## v9.0.1
- improved logging levels throughout the script #408

View File

@@ -242,8 +242,12 @@ getAppVersion() {
# printlog "App(s) found: ${applist}" DEBUG
# applist=$(mdfind "kind:application AND name:$appName" -0 )
fi
if [[ -z applist ]]; then
printlog "No previous app found" INFO
if [[ -z $applist ]]; then
if [[ $SKIP_UNINSTALLED -eq 1 ]]; then
cleanupAndExit 0 "No previous app found, and SKIP_UNINSTALLED=1." REQ
else
printlog "No previous app found" WARN
fi
else
printlog "App(s) found: ${applist}" INFO
fi
@@ -265,7 +269,7 @@ getAppVersion() {
if [[ -d "$installedAppPath"/Contents/_MASReceipt ]];then
printlog "Installed $appName is from App Store, use “IGNORE_APP_STORE_APPS=yes” to replace."
if [[ $IGNORE_APP_STORE_APPS == "yes" ]]; then
printlog "Replacing App Store apps, no matter the version"
printlog "Replacing App Store apps, no matter the version" WARN
appversion=0
else
cleanupAndExit 1 "App previously installed from App Store, and we respect that" ERROR

View File

@@ -110,6 +110,13 @@ INSTALL=""
# if it is newer/different in version
# - force Install even if its the same version
# skip if app is not currently installed
SKIP_UNINSTALLED=0
# options:
# - 0 Run normally and install the app if other conditions are met.
# - 1 If app is not currently installed we will not install anything.
# This is mostly done in the getAppVersion function, and if it cannot
# locate the app, the script will exit.
# Re-opening of closed app
REOPEN="yes"

View File

@@ -93,6 +93,7 @@ if [ -z "$appName" ]; then
# when not given derive from name
appName="$name.app"
fi
printlog "appName: $appName" INFO
if [ -z "$targetDir" ]; then
case $type in