From 1477457155205e26f59893b791bda23bc7ce3bba Mon Sep 17 00:00:00 2001 From: Armin Briegel <1933192+scriptingosx@users.noreply.github.com> Date: Fri, 12 Aug 2022 13:47:44 +0200 Subject: [PATCH] updated redundant exit codes, closes #561 See also: https://github.com/Installomator/Installomator/wiki/Installomator-Exit-Codes --- fragments/functions.sh | 14 +++++++------- fragments/labels/macports.sh | 2 +- fragments/main.sh | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/fragments/functions.sh b/fragments/functions.sh index ddbe70f..4d19d91 100644 --- a/fragments/functions.sh +++ b/fragments/functions.sh @@ -163,7 +163,7 @@ downloadURLFromGit() { # $1 git user name, $2 git repo name | awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }") fi if [ -z "$downloadURL" ]; then - cleanupAndExit 9 "could not retrieve download URL for $gitusername/$gitreponame" ERROR + cleanupAndExit 14 "could not retrieve download URL for $gitusername/$gitreponame" ERROR else echo "$downloadURL" return 0 @@ -278,7 +278,7 @@ getAppVersion() { 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 + cleanupAndExit 23 "App previously installed from App Store, and we respect that" ERROR fi fi else @@ -475,7 +475,7 @@ installAppWithPath() { # $1: path to app to install in $targetDir printlog "notifying" displaynotification "$message" "Error updating $name!" fi - cleanupAndExit 6 "Installed macOS is too old for this app." ERROR + cleanupAndExit 15 "Installed macOS is too old for this app." ERROR fi fi @@ -534,7 +534,7 @@ installAppWithPath() { # $1: path to app to install in $targetDir deduplicatelogs "$CLIoutput" if [ $CLIstatus -ne 0 ] ; then - cleanupAndExit 3 "Error installing $mountname/$CLIInstaller $CLIArguments error:\n$logoutput" ERROR + cleanupAndExit 16 "Error installing $mountname/$CLIInstaller $CLIArguments error:\n$logoutput" ERROR else printlog "Succesfully ran $mountname/$CLIInstaller $CLIArguments" INFO fi @@ -732,7 +732,7 @@ installPkgInZip() { printlog "Found pkg(s):\n$findfiles" DEBUG filearray=( ${(f)findfiles} ) if [[ ${#filearray} -eq 0 ]]; then - cleanupAndExit 20 "couldn't find pkg in zip $archiveName" ERROR + cleanupAndExit 21 "couldn't find pkg in zip $archiveName" ERROR fi # it is now safe to overwrite archiveName for installFromPKG archiveName="${filearray[1]}" @@ -745,7 +745,7 @@ installPkgInZip() { findfiles=$(find "$tmpDir" -iname "$pkgName") filearray=( ${(f)findfiles} ) if [[ ${#filearray} -eq 0 ]]; then - cleanupAndExit 20 "couldn't find pkg “$pkgName” in zip $archiveName" ERROR + cleanupAndExit 21 "couldn't find pkg “$pkgName” in zip $archiveName" ERROR fi # it is now safe to overwrite archiveName for installFromPKG archiveName="${filearray[1]}" @@ -768,7 +768,7 @@ installAppInDmgInZip() { findfiles=$(find "$tmpDir" -iname "*.dmg" -maxdepth 2 ) filearray=( ${(f)findfiles} ) if [[ ${#filearray} -eq 0 ]]; then - cleanupAndExit 20 "couldn't find dmg in zip $archiveName" ERROR + cleanupAndExit 22 "couldn't find dmg in zip $archiveName" ERROR fi archiveName="$(basename ${filearray[1]})" # it is now safe to overwrite archiveName for installFromDMG diff --git a/fragments/labels/macports.sh b/fragments/labels/macports.sh index 6a473a1..9f3c7be 100644 --- a/fragments/labels/macports.sh +++ b/fragments/labels/macports.sh @@ -13,7 +13,7 @@ macports) archiveName="Catalina.pkg" ;; *) - cleanupAndExit 1 "macOS 10.14 or earlier not supported by Installomator." + cleanupAndExit 98 "macOS 10.14 or earlier not supported by Installomator." ;; esac downloadURL=$(downloadURLFromGit macports macports-base) diff --git a/fragments/main.sh b/fragments/main.sh index 9a665c7..39f737d 100644 --- a/fragments/main.sh +++ b/fragments/main.sh @@ -18,7 +18,7 @@ fi if [[ ${INTERRUPT_DND} = "no" ]]; then # Check if a fullscreen app is active if hasDisplaySleepAssertion; then - cleanupAndExit 1 "active display sleep assertion detected, aborting" ERROR + cleanupAndExit 24 "active display sleep assertion detected, aborting" ERROR fi fi @@ -132,7 +132,7 @@ fi # MARK: change directory to temporary working directory printlog "Changing directory to $tmpDir" DEBUG if ! cd "$tmpDir"; then - cleanupAndExit 1 "error changing directory $tmpDir" ERROR + cleanupAndExit 13 "error changing directory $tmpDir" ERROR fi # MARK: get installed version