diff --git a/Installomator.sh b/Installomator.sh index 545a928..cbe623c 100755 --- a/Installomator.sh +++ b/Installomator.sh @@ -114,6 +114,12 @@ REOPEN="yes" # If given, it will be compared to installed version, to see if download is different. # It does not check for newer or not, only different. # +# - versionKey: (optional) +# How we get version number from app. Possible values: +# - CFBundleShortVersionString +# - CFBundleVersion +# Not all software titles uses fields the same. Opera uses the latter. +# # - expectedTeamID: (required) # 10-digit developer team ID. # Obtain the team ID by running: @@ -332,7 +338,7 @@ getAppVersion() { if [[ ${#filteredAppPaths} -eq 1 ]]; then installedAppPath=$filteredAppPaths[1] #appversion=$(mdls -name kMDItemVersion -raw $installedAppPath ) - appversion=$(defaults read $installedAppPath/Contents/Info.plist CFBundleShortVersionString) #Not dependant on Spotlight indexing + appversion=$(defaults read $installedAppPath/Contents/Info.plist $versionKey) #Not dependant on Spotlight indexing printlog "found app at $installedAppPath, version $appversion" else printlog "could not determine location of $appName" @@ -480,7 +486,7 @@ installAppWithPath() { # $1: path to app to install in $targetDir # versioncheck # credit: Søren Theilgaard (@theilgaard) - appNewVersion=$(defaults read $appPath/Contents/Info.plist CFBundleShortVersionString) + appNewVersion=$(defaults read $appPath/Contents/Info.plist $versionKey) if [[ $appversion == $appNewVersion ]]; then printlog "Downloaded version of $name is $appNewVersion, same as installed." if [[ $INSTALL != "force" ]]; then @@ -797,6 +803,10 @@ label=${label:l} printlog "################## Start Installomator v. $VERSION" printlog "################## $label" +# How we get version number from app +# (alternative is "CFBundleVersion", that can be used in labels) +versionKey="CFBundleShortVersionString" + # get current user currentUser=$(scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ { print $3 }') @@ -2009,8 +2019,9 @@ openvpnconnectv3) opera) name="Opera" type="dmg" - downloadURL="https://get.geo.opera.com/ftp/pub/opera/desktop/"$( curl -fs "https://get.geo.opera.com/ftp/pub/opera/desktop/" | grep href | tail -1 | tr '"' '\n' | grep "/" | head -1 )"mac/Opera_"$( curl -fs "https://get.geo.opera.com/ftp/pub/opera/desktop/" | grep href | tail -1 | tr '"' '\n' | grep "/" | head -1 | sed -E 's/^([0-9.]*)\//\1/g' )"_Setup.dmg" - appNewVersion="$( curl -fs "https://get.geo.opera.com/ftp/pub/opera/desktop/" | grep href | tail -1 | tr '"' '\n' | grep "/" | head -1 | sed -E 's/^([0-9]*\.[0-9]*).*\//\1/g' )" + downloadURL=$(curl -fsIL "$(curl -fs "$(curl -fsIL "https://download.opera.com/download/get/?partner=www&opsys=MacOS" | grep -i "^location" | cut -d " " -f2 | tail -1 | tr -d '\r')" | grep download.opera.com | grep -io "https.*yes" | sed 's/\&/\&/g')" | grep -i "^location" | cut -d " " -f2 | tr -d '\r') + appNewVersion="$(curl -fs "https://get.geo.opera.com/ftp/pub/opera/desktop/" | grep "href=\"\d" | sort -V | tail -1 | tr '"' '\n' | grep "/" | head -1 | tr -d '/')" + versionKey="CFBundleVersion" expectedTeamID="A2P9LX4JPN" ;; pacifist) @@ -2383,8 +2394,10 @@ taskpaper) teamviewer) name="TeamViewer" type="pkgInDmg" + packageID="com.teamviewer.teamviewer" pkgName="Install TeamViewer.app/Contents/Resources/Install TeamViewer.pkg" downloadURL="https://download.teamviewer.com/download/TeamViewer.dmg" + appNewVersion=$(curl -fs "https://www.teamviewer.com/en/download/mac-os/" | grep "Current version" | cut -d " " -f3 | cut -d "<" -f1) expectedTeamID="H7UGFBUGV6" ;; teamviewerhost) @@ -2392,6 +2405,7 @@ teamviewerhost) type="pkgInDmg" packageID="com.teamviewer.teamviewerhost" pkgName="Install TeamViewerHost.app/Contents/Resources/Install TeamViewerHost.pkg" downloadURL="https://download.teamviewer.com/download/TeamViewerHost.dmg" + appNewVersion=$(curl -fs "https://www.teamviewer.com/en/download/mac-os/" | grep "Current version" | cut -d " " -f3 | cut -d "<" -f1) expectedTeamID="H7UGFBUGV6" #blockingProcessesMaxCPU="5" # Future feature #Company="TeamViewer GmbH" @@ -2401,6 +2415,7 @@ teamviewerqs) name="TeamViewerQS" type="dmg" downloadURL="https://download.teamviewer.com/download/TeamViewerQS.dmg" + appNewVersion=$(curl -fs "https://www.teamviewer.com/en/download/mac-os/" | grep "Current version" | cut -d " " -f3 | cut -d "<" -f1) appName="TeamViewerQS.app" expectedTeamID="H7UGFBUGV6" ;;