updated redundant exit codes, closes #561

See also: https://github.com/Installomator/Installomator/wiki/Installomator-Exit-Codes
This commit is contained in:
Armin Briegel
2022-08-12 13:47:44 +02:00
parent 4e5f069024
commit 1477457155
3 changed files with 10 additions and 10 deletions

View File

@@ -163,7 +163,7 @@ downloadURLFromGit() { # $1 git user name, $2 git repo name
| awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }") | awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }")
fi fi
if [ -z "$downloadURL" ]; then 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 else
echo "$downloadURL" echo "$downloadURL"
return 0 return 0
@@ -278,7 +278,7 @@ getAppVersion() {
printlog "Replacing App Store apps, no matter the version" WARN printlog "Replacing App Store apps, no matter the version" WARN
appversion=0 appversion=0
else 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
fi fi
else else
@@ -475,7 +475,7 @@ installAppWithPath() { # $1: path to app to install in $targetDir
printlog "notifying" printlog "notifying"
displaynotification "$message" "Error updating $name!" displaynotification "$message" "Error updating $name!"
fi 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
fi fi
@@ -534,7 +534,7 @@ installAppWithPath() { # $1: path to app to install in $targetDir
deduplicatelogs "$CLIoutput" deduplicatelogs "$CLIoutput"
if [ $CLIstatus -ne 0 ] ; then 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 else
printlog "Succesfully ran $mountname/$CLIInstaller $CLIArguments" INFO printlog "Succesfully ran $mountname/$CLIInstaller $CLIArguments" INFO
fi fi
@@ -732,7 +732,7 @@ installPkgInZip() {
printlog "Found pkg(s):\n$findfiles" DEBUG printlog "Found pkg(s):\n$findfiles" DEBUG
filearray=( ${(f)findfiles} ) filearray=( ${(f)findfiles} )
if [[ ${#filearray} -eq 0 ]]; then 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 fi
# it is now safe to overwrite archiveName for installFromPKG # it is now safe to overwrite archiveName for installFromPKG
archiveName="${filearray[1]}" archiveName="${filearray[1]}"
@@ -745,7 +745,7 @@ installPkgInZip() {
findfiles=$(find "$tmpDir" -iname "$pkgName") findfiles=$(find "$tmpDir" -iname "$pkgName")
filearray=( ${(f)findfiles} ) filearray=( ${(f)findfiles} )
if [[ ${#filearray} -eq 0 ]]; then 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 fi
# it is now safe to overwrite archiveName for installFromPKG # it is now safe to overwrite archiveName for installFromPKG
archiveName="${filearray[1]}" archiveName="${filearray[1]}"
@@ -768,7 +768,7 @@ installAppInDmgInZip() {
findfiles=$(find "$tmpDir" -iname "*.dmg" -maxdepth 2 ) findfiles=$(find "$tmpDir" -iname "*.dmg" -maxdepth 2 )
filearray=( ${(f)findfiles} ) filearray=( ${(f)findfiles} )
if [[ ${#filearray} -eq 0 ]]; then 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 fi
archiveName="$(basename ${filearray[1]})" archiveName="$(basename ${filearray[1]})"
# it is now safe to overwrite archiveName for installFromDMG # it is now safe to overwrite archiveName for installFromDMG

View File

@@ -13,7 +13,7 @@ macports)
archiveName="Catalina.pkg" 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 esac
downloadURL=$(downloadURLFromGit macports macports-base) downloadURL=$(downloadURLFromGit macports macports-base)

View File

@@ -18,7 +18,7 @@ fi
if [[ ${INTERRUPT_DND} = "no" ]]; then if [[ ${INTERRUPT_DND} = "no" ]]; then
# Check if a fullscreen app is active # Check if a fullscreen app is active
if hasDisplaySleepAssertion; then if hasDisplaySleepAssertion; then
cleanupAndExit 1 "active display sleep assertion detected, aborting" ERROR cleanupAndExit 24 "active display sleep assertion detected, aborting" ERROR
fi fi
fi fi
@@ -132,7 +132,7 @@ fi
# MARK: change directory to temporary working directory # MARK: change directory to temporary working directory
printlog "Changing directory to $tmpDir" DEBUG printlog "Changing directory to $tmpDir" DEBUG
if ! cd "$tmpDir"; then if ! cd "$tmpDir"; then
cleanupAndExit 1 "error changing directory $tmpDir" ERROR cleanupAndExit 13 "error changing directory $tmpDir" ERROR
fi fi
# MARK: get installed version # MARK: get installed version