From 44a64b83b92709e687815d6447521bf791ad4745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Fri, 3 Sep 2021 14:01:06 +0200 Subject: [PATCH] `buildLabel.sh` and airtame --- Labels.txt | 1 + fragments/disabled/cdef.sh | 10 ------- fragments/labels/airtame.sh | 7 +++++ fragments/labels/ringcentralclassicapp.sh | 2 +- fragments/labels/screencloudplayer.sh | 12 ++++----- utils/buildLabel.sh | 33 +++++++++++++++++------ 6 files changed, 40 insertions(+), 25 deletions(-) delete mode 100644 fragments/disabled/cdef.sh create mode 100644 fragments/labels/airtame.sh diff --git a/Labels.txt b/Labels.txt index 766ae38..ebda2ef 100644 --- a/Labels.txt +++ b/Labels.txt @@ -9,6 +9,7 @@ adobereaderdc-install adobereaderdc-update aircall airserver +airtame aldente alfred alttab diff --git a/fragments/disabled/cdef.sh b/fragments/disabled/cdef.sh deleted file mode 100644 index 21a0641..0000000 --- a/fragments/disabled/cdef.sh +++ /dev/null @@ -1,10 +0,0 @@ - -cdef) - # cdef currently not signed - # credit: Søren Theilgaard (@theilgaard) - name="cdef" - type="pkg" - downloadURL=$(downloadURLFromGit Shufflepuck cdef) - appNewVersion=$(versionFromGit Shufflepuck cdef) - #expectedTeamID="EM3ER8T33A" - ;; diff --git a/fragments/labels/airtame.sh b/fragments/labels/airtame.sh new file mode 100644 index 0000000..bbc5dc7 --- /dev/null +++ b/fragments/labels/airtame.sh @@ -0,0 +1,7 @@ +airtame) + name="Airtame" + type="dmg" + downloadURL="$(curl -fs https://airtame.com/download/ | grep -i platform=mac | head -1 | grep -o -i -E "https.*" | cut -d '"' -f1)" + appNewVersion="$(curl -fsIL "${downloadURL}" | grep -i ^location | sed -E 's/.*\/[a-zA-Z]*-([0-9.]*)\..*/\1/g')" + expectedTeamID="4TPSP88HN2" + ;; \ No newline at end of file diff --git a/fragments/labels/ringcentralclassicapp.sh b/fragments/labels/ringcentralclassicapp.sh index 78d4186..ef75cee 100644 --- a/fragments/labels/ringcentralclassicapp.sh +++ b/fragments/labels/ringcentralclassicapp.sh @@ -5,4 +5,4 @@ ringcentralclassicapp) expectedTeamID="M932RC5J66" blockingProcesses=( "Glip" ) #blockingProcessesMaxCPU="5" - ;; + ;; \ No newline at end of file diff --git a/fragments/labels/screencloudplayer.sh b/fragments/labels/screencloudplayer.sh index 2bab204..e7c1604 100644 --- a/fragments/labels/screencloudplayer.sh +++ b/fragments/labels/screencloudplayer.sh @@ -1,7 +1,7 @@ screencloudplayer) - # credit: AP Orlebeke (@apizz) - name="ScreenCloud Player" - type="dmg" - downloadURL=$(curl -sL "https://screencloud.com/download" | sed -n 's/^.*"url":"\([^"]*\)".*$/\1/p') - expectedTeamID="3C4F953K6P" - ;; \ No newline at end of file + # credit: AP Orlebeke (@apizz) + name="ScreenCloud Player" + type="dmg" + downloadURL=$(curl -sL "https://screencloud.com/download" | sed -n 's/^.*"url":"\([^"]*\)".*$/\1/p') + expectedTeamID="3C4F953K6P" + ;; \ No newline at end of file diff --git a/utils/buildLabel.sh b/utils/buildLabel.sh index b855208..0e4f2c8 100755 --- a/utils/buildLabel.sh +++ b/utils/buildLabel.sh @@ -2,7 +2,7 @@ export PATH=/usr/bin:/bin:/usr/sbin:/sbin -downloadURL=${1?:"need to provide a download URL"} +downloadURL=${1?:"need to provide a download URL."} # Note: this tool _very_ experimental and does not work in many cases # That being said, it's a great place to start for building up the label in the Case-statement @@ -10,19 +10,23 @@ downloadURL=${1?:"need to provide a download URL"} # Usage # ./buildLabel.sh -tmpDir=$(pwd) # use working directory as download folder (REMEMBER to comment out removal of tmpDir in bottom of script) +# Use working directory as download folder +tmpDir=$(date "+%Y-%m-%d-%H-%M-%S") +# Create a n almost unique folder name +mkdir $tmpDir # change directory to temporary working directory echo "Changing directory to $tmpDir" if ! cd "$tmpDir"; then - echo "error changing directory $tmpDir" - #rm -Rf "$tmpDir" + echo "Error changing directory $tmpDir" exit 1 fi +echo "Working dir: $(pwd)" # download the URL echo "Downloading $downloadURL" -if ! downloadOut="$(curl -fsL "$downloadURL" --remote-header-name --remote-name -w "%{filename_effective}\n%{url_effective}\n")"; then +echo "Redirecting to (maybe this can help us with version):\n$(curl -fsIL "$downloadURL" | grep -i ^location)" +if ! downloadOut="$(curl -fL "$downloadURL" --remote-header-name --remote-name -w "%{filename_effective}\n%{url_effective}\n")"; then echo "error downloading $downloadURL" exit 2 fi @@ -60,12 +64,25 @@ appInvestigation() { exit 4 fi } -echo "downloadOut: ${downloadOut}" + +echo "downloadOut:\n${downloadOut}" archiveTempName=$( echo "${downloadOut}" | head -1 ) echo "archiveTempName: $archiveTempName" archivePath=$( echo "${downloadOut}" | tail -1 ) echo "archivePath: $archivePath" -archiveName=${archivePath##*/} + +try1archiveName=${archiveTempName##*/} +try2archiveName=${archivePath##*/} +fileName_re='^([a-zA-Z0-9\_.-]*)\.(dmg|pkg|zip|tbz)$' +if [[ "${try1archiveName}" =~ $fileName_re ]]; then + archiveName=${try1archiveName} +elif [[ "${try2archiveName}" =~ $fileName_re ]]; then + archiveName=${try2archiveName} +else + echo "Could not determine archiveName from “$try1archiveName” and “$try2archiveName”" + exit +fi + echo "archiveName: $archiveName" mv $archiveTempName $archiveName name=${archiveName%.*} @@ -125,7 +142,7 @@ echo "**********" echo echo "Labels should be named in small caps, numbers 0-9, “-”, and “_”. No other characters allowed." echo -echo "appNewVersion is often difficult to find. Can sometimes be found in the filename, but also on a web page. See archivePath above if link contains information about this." +echo "appNewVersion is often difficult to find. Can sometimes be found in the filename, sometimes as part of the download redirects, but also on a web page. See redirect and archivePath above if link contains information about this. That is a good place to start" echo echo "$identifier)" echo " name=\"$name\""