Force install improvements

If using INSTALL=force, the script will not be using updateTool, but will reinstall instead.
microsoftteams label was still having appNewVersion that does not work, so that has been commented out.
This commit is contained in:
Søren Theilgaard
2021-05-17 13:08:48 +02:00
parent e64fe9fcda
commit cad509accd

View File

@@ -3010,7 +3010,7 @@ microsoftteams)
type="pkg" type="pkg"
#packageID="com.microsoft.teams" #packageID="com.microsoft.teams"
downloadURL="https://go.microsoft.com/fwlink/?linkid=869428" downloadURL="https://go.microsoft.com/fwlink/?linkid=869428"
appNewVersion=$(curl -fs https://macadmins.software/latest.xml | xpath '//latest/package[id="com.microsoft.teams.standalone"]/version' 2>/dev/null | sed -E 's/<version>([0-9.]*) .*/\1/') #appNewVersion=$(curl -fs https://macadmins.software/latest.xml | xpath '//latest/package[id="com.microsoft.teams.standalone"]/version' 2>/dev/null | sed -E 's/<version>([0-9.]*) .*/\1/')
# Still using macadmin.software for version, as the path does not contain the version in a matching format. packageID can be used, but version is the same. # Still using macadmin.software for version, as the path does not contain the version in a matching format. packageID can be used, but version is the same.
expectedTeamID="UBF8T346G9" expectedTeamID="UBF8T346G9"
blockingProcesses=( Teams "Microsoft Teams Helper" ) blockingProcesses=( Teams "Microsoft Teams Helper" )
@@ -3202,23 +3202,9 @@ if ! cd "$tmpDir"; then
cleanupAndExit 1 cleanupAndExit 1
fi fi
# MARK: check if this is an Update and we can use updateTool # MARK: get installed version
getAppVersion getAppVersion
printlog "appversion: $appversion" printlog "appversion: $appversion"
if [[ (-n $appversion && -n "$updateTool") || "$type" == "updateronly" ]]; then
printlog "appversion & updateTool"
if [[ $DEBUG -eq 0 ]]; then
if runUpdateTool; then
finishing
cleanupAndExit 0
elif [[ $type == "updateronly" ]];then
printlog "type is $type so we end here."
cleanupAndExit 0
fi # otherwise continue
else
printlog "DEBUG mode enabled, not running update tool"
fi
fi
# MARK: Exit if new version is the same as installed version (appNewVersion specified) # MARK: Exit if new version is the same as installed version (appNewVersion specified)
# credit: Søren Theilgaard (@theilgaard) # credit: Søren Theilgaard (@theilgaard)
@@ -3235,7 +3221,8 @@ if [[ -n $appNewVersion ]]; then
fi fi
cleanupAndExit 0 "No newer version." cleanupAndExit 0 "No newer version."
else else
printlog "Using force to install anyway." printlog "Using force to install anyway. Not using updateTool."
updateTool=""
fi fi
else else
printlog "DEBUG mode enabled, not exiting, but there is no new version of app." printlog "DEBUG mode enabled, not exiting, but there is no new version of app."
@@ -3243,6 +3230,26 @@ if [[ -n $appNewVersion ]]; then
fi fi
else else
printlog "Latest version not specified." printlog "Latest version not specified."
if [[ $INSTALL == "force" ]]; then
printlog "Using force to install, so not using updateTool."
updateTool=""
fi
fi
# MARK: check if this is an Update and we can use updateTool
if [[ (-n $appversion && -n "$updateTool") || "$type" == "updateronly" ]]; then
printlog "appversion & updateTool"
if [[ $DEBUG -eq 0 ]]; then
if runUpdateTool; then
finishing
cleanupAndExit 0
elif [[ $type == "updateronly" ]];then
printlog "type is $type so we end here."
cleanupAndExit 0
fi # otherwise continue
else
printlog "DEBUG mode enabled, not running update tool"
fi
fi fi
# MARK: download the archive # MARK: download the archive