From e64fe9fcda90013f3f2912309e158bbc5670bf40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Wed, 12 May 2021 11:17:07 +0200 Subject: [PATCH] appCustomVersion(){} This can be used in a label now. --- Installomator.sh | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/Installomator.sh b/Installomator.sh index 20790e5..4aabbc8 100755 --- a/Installomator.sh +++ b/Installomator.sh @@ -118,7 +118,13 @@ REOPEN="yes" # How we get version number from app. Possible values: # - CFBundleShortVersionString # - CFBundleVersion -# Not all software titles uses fields the same. Opera uses the latter. +# Not all software titles uses fields the same. +# See Opera label. +# +# - appCustomVersion(){}: (optional function) +# This function can be added to your label, if a specific custom +# mechanism hs to be used for getting the installed version. +# See labels zulujdk11, zulujdk13, zulujdk15 # # - expectedTeamID: (required) # 10-digit developer team ID. @@ -310,7 +316,15 @@ xpath() { getAppVersion() { - # modified by: Søren Theilgaard (@theilgaard) + # modified by: Søren Theilgaard (@theilgaard) and Isaac Ordonez + + # If label contain function appCustomVersion, we use that and return + if type 'appCustomVersion' 2>/dev/null | grep -q 'function'; then + appversion=$(appCustomVersion) + printlog "Custom App Version detection is used, found $appversion" + return + fi + # pkgs contains a version number, then we don't have to search for an app if [[ $packageID != "" ]]; then appversion="$(pkgutil --pkg-info-plist ${packageID} 2>/dev/null | grep -A 1 pkg-version | tail -1 | sed -E 's/.*>([0-9.]*)<.*/\1/g')" @@ -1586,6 +1600,7 @@ installomator_st) packageID="dk.theilgaard.pkg.Installomator" downloadURL=$(downloadURLFromGit theile Installomator ) appNewVersion=$(versionFromGit theile Installomator ) + #appCustomVersion(){/usr/local/bin/Installomator.sh version | tail -1 | awk '{print $4}'} expectedTeamID="L8W73B6AH3" blockingProcesses=( NONE ) ;; @@ -2625,7 +2640,7 @@ wireshark) name="Wireshark" type="dmg" downloadURL="https://1.as.dl.wireshark.org/osx/Wireshark%20Latest%20Intel%2064.dmg" - appNewVersion=$(curl -fs https://www.wireshark.org/download.html | grep "Stable Release" | grep -o "(.*.)" | cut -f2 | head -1 | awk -F'[()]' '{print $2}') + appNewVersion=$(curl -fs https://www.wireshark.org/download.html | grep "Stable Release" | grep -o "(.*.)" | cut -f2 | head -1 | awk -F '[()]' '{print $2}') expectedTeamID="7Z6EMTD2C6" ;; xink) @@ -2690,8 +2705,8 @@ zulujdk11) downloadURL=$(curl -fs "https://www.azul.com/downloads/zulu-community/" | xmllint --html --format - 2>/dev/null | tr , '\n' | grep -o "https:.*/zulu11.*ca-jdk11.*aarch64.dmg" | sed 's/\\//g') fi expectedTeamID="TDTHCUPYFR" - #appCustomVersion(){ java -version 2>&1 | grep Runtime | awk '{print $4}' | sed -e "s/.*Zulu//" | cut -d '-' -f 1 | sed -e "s/+/\./" } - #appNewVersion=$(echo "$downloadURL" | cut -d "-" -f 1 | sed -e "s/.*zulu//") # Cannot be compared to anything + appCustomVersion(){ java -version 2>&1 | grep Runtime | awk '{print $4}' | sed -e "s/.*Zulu//" | cut -d '-' -f 1 | sed -e "s/+/\./" } + appNewVersion=$(echo "$downloadURL" | cut -d "-" -f 1 | sed -e "s/.*zulu//") # Cannot be compared to anything #Company="Azul" #PatchSkip="YES" ;; @@ -2705,8 +2720,8 @@ zulujdk13) downloadURL=$(curl -fs "https://www.azul.com/downloads/zulu-community/" | xmllint --html --format - 2>/dev/null | tr , '\n' | grep -o "https:.*/zulu13.*ca-jdk13.*aarch64.dmg" | sed 's/\\//g') fi expectedTeamID="TDTHCUPYFR" - #appCustomVersion(){ java -version 2>&1 | grep Runtime | awk '{print $4}' | sed -e "s/.*Zulu//" | cut -d '-' -f 1 | sed -e "s/+/\./" } - #appNewVersion=$(echo "$downloadURL" | cut -d "-" -f 1 | sed -e "s/.*zulu//") # Cannot be compared to anything + appCustomVersion(){ java -version 2>&1 | grep Runtime | awk '{print $4}' | sed -e "s/.*Zulu//" | cut -d '-' -f 1 | sed -e "s/+/\./" } + appNewVersion=$(echo "$downloadURL" | cut -d "-" -f 1 | sed -e "s/.*zulu//") # Cannot be compared to anything #Company="Azul" #PatchSkip="YES" ;; @@ -2720,8 +2735,8 @@ zulujdk15) downloadURL=$(curl -fs "https://www.azul.com/downloads/zulu-community/" | xmllint --html --format - 2>/dev/null | tr , '\n' | grep -o "https:.*/zulu15.*ca-jdk15.*aarch64.dmg" | sed 's/\\//g') fi expectedTeamID="TDTHCUPYFR" - #appCustomVersion(){ java -version 2>&1 | grep Runtime | awk '{print $4}' | sed -e "s/.*Zulu//" | cut -d '-' -f 1 | sed -e "s/+/\./" } - #appNewVersion=$(echo "$downloadURL" | cut -d "-" -f 1 | sed -e "s/.*zulu//") # Cannot be compared to anything + appCustomVersion(){ java -version 2>&1 | grep Runtime | awk '{print $4}' | sed -e "s/.*Zulu//" | cut -d '-' -f 1 | sed -e "s/+/\./" } + appNewVersion=$(echo "$downloadURL" | cut -d "-" -f 1 | sed -e "s/.*zulu//") # Cannot be compared to anything #Company="Azul" #PatchSkip="YES" ;;