From cad509accd23e8d725b60e843fe373fe041f4832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Mon, 17 May 2021 13:08:48 +0200 Subject: [PATCH] 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. --- Installomator.sh | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/Installomator.sh b/Installomator.sh index 4aabbc8..0eb87c2 100755 --- a/Installomator.sh +++ b/Installomator.sh @@ -3010,7 +3010,7 @@ microsoftteams) type="pkg" #packageID="com.microsoft.teams" 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/([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/([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. expectedTeamID="UBF8T346G9" blockingProcesses=( Teams "Microsoft Teams Helper" ) @@ -3202,23 +3202,9 @@ if ! cd "$tmpDir"; then cleanupAndExit 1 fi -# MARK: check if this is an Update and we can use updateTool +# MARK: get installed version getAppVersion 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) # credit: Søren Theilgaard (@theilgaard) @@ -3235,7 +3221,8 @@ if [[ -n $appNewVersion ]]; then fi cleanupAndExit 0 "No newer version." else - printlog "Using force to install anyway." + printlog "Using force to install anyway. Not using updateTool." + updateTool="" fi else printlog "DEBUG mode enabled, not exiting, but there is no new version of app." @@ -3243,6 +3230,26 @@ if [[ -n $appNewVersion ]]; then fi else 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 # MARK: download the archive