From fe4c8a96da569b02aa2d657c6bd7f8b77c9839bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Mon, 10 Jan 2022 13:04:04 +0100 Subject: [PATCH 01/21] brave fix --- fragments/labels/brave.sh | 4 ++-- fragments/main.sh | 24 ++++++++++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/fragments/labels/brave.sh b/fragments/labels/brave.sh index 6e16d6d..ef9df31 100644 --- a/fragments/labels/brave.sh +++ b/fragments/labels/brave.sh @@ -3,12 +3,12 @@ brave) type="dmg" if [[ $(arch) != "i386" ]]; then printlog "Architecture: arm64 (not i386)" - downloadURL=$(curl -fsIL https://laptop-updates.brave.com/latest/osxarm64/release | grep -i "^location" | awk '{print $2}') + downloadURL=$(curl -fsIL https://laptop-updates.brave.com/latest/osxarm64/release | grep -i "^location" | sed -E 's/.*(https.*\.dmg).*/\1/g') appNewVersion="$(curl -fsL "https://updates.bravesoftware.com/sparkle/Brave-Browser/stable-arm64/appcast.xml" | xpath '//rss/channel/item[last()]/enclosure/@sparkle:version' 2>/dev/null | cut -d '"' -f 2)" #appNewVersion="96.$(curl -fsL "https://updates.bravesoftware.com/sparkle/Brave-Browser/stable-arm64/appcast.xml" | xpath '//rss/channel/item[last()]/enclosure/@sparkle:shortVersionString' 2>/dev/null | cut -d '"' -f 2 | cut -d "." -f1-3)" else printlog "Architecture: i386" - downloadURL=$(curl -fsIL https://laptop-updates.brave.com/latest/osx/release | grep -i "^location" | awk '{print $2}') + downloadURL=$(curl -fsIL https://laptop-updates.brave.com/latest/osx/release | grep -i "^location" | sed -E 's/.*(https.*\.dmg).*/\1/g') appNewVersion="$(curl -fsL "https://updates.bravesoftware.com/sparkle/Brave-Browser/stable/appcast.xml" | xpath '//rss/channel/item[last()]/enclosure/@sparkle:version' 2>/dev/null | cut -d '"' -f 2)" #appNewVersion="96.$(curl -fsL "https://updates.bravesoftware.com/sparkle/Brave-Browser/stable/appcast.xml" | xpath '//rss/channel/item[last()]/enclosure/@sparkle:shortVersionString' 2>/dev/null | cut -d '"' -f 2 | cut -d "." -f1-3)" fi diff --git a/fragments/main.sh b/fragments/main.sh index cef364c..2eb8781 100644 --- a/fragments/main.sh +++ b/fragments/main.sh @@ -179,17 +179,25 @@ else fi fi if ! curl --location --fail --silent "$downloadURL" -o "$archiveName"; then - printlog "error downloading $downloadURL" - message="$name update/installation failed. This will be logged, so IT can follow up." - if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then - printlog "notifying" - if [[ $updateDetected == "YES" ]]; then - displaynotification "$message" "Error updating $name" + if ! curl -fsL -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" -H "accept-encoding: gzip, deflate, br" -H "upgrade-insecure-requests: 1" -H "sec-fetch-dest: document" -H "sec-gpc: 1" -H "sec-fetch-user: ?1" -H "accept-language: en-US,en;q=0.9" -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" -H "sec-fetch-mode: navigate" "$downloadURL" -o "$archiveName"; then + if ! curl -fsL -H "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36" -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" -H "accept-encoding: gzip, deflate, br" -H "accept-language: en-US,en;q=0.9" -H "sec-fetch-dest: document" -H "sec-fetch-mode: navigate" -H "sec-fetch-site: same-site" -H "sec-fetch-user: ?1" -H "sec-gpc: 1" -H "upgrade-insecure-requests: 1" "$downloadURL" -o "$archiveName"; then + printlog "error downloading $downloadURL" + message="$name update/installation failed. This will be logged, so IT can follow up." + if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then + printlog "notifying" + if [[ $updateDetected == "YES" ]]; then + displaynotification "$message" "Error updating $name" + else + displaynotification "$message" "Error installing $name" + fi + fi + cleanupAndExit 2 else - displaynotification "$message" "Error installing $name" + printlog "Downloaded with all headers." fi + else + printlog "Downloaded with exta headers." fi - cleanupAndExit 2 fi fi From a8c9fdbab7a58171ec80104dda3e272c94f39b50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Mon, 10 Jan 2022 20:26:53 +0100 Subject: [PATCH 02/21] Download with extra sets of headers --- CHANGELOG.md | 1 + .../{disabled => labels}/mochakeyboard.sh | 0 fragments/{disabled => labels}/mochatelnet.sh | 0 fragments/{disabled => labels}/mochatn3270.sh | 0 fragments/{disabled => labels}/mochatn3812.sh | 0 fragments/{disabled => labels}/mochatn5250.sh | 0 fragments/main.sh | 73 +++++++++--- utils/buildLabel.sh | 111 +++++++++++++++--- 8 files changed, 149 insertions(+), 36 deletions(-) rename fragments/{disabled => labels}/mochakeyboard.sh (100%) rename fragments/{disabled => labels}/mochatelnet.sh (100%) rename fragments/{disabled => labels}/mochatn3270.sh (100%) rename fragments/{disabled => labels}/mochatn3812.sh (100%) rename fragments/{disabled => labels}/mochatn5250.sh (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dd2a79..11f3056 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - New variable `RETURN_LABEL_NAME`. If given the value `1`, like `RETURN_LABEL_NAME=1` then Installomator only returns the name of the label. It makes for a better user friendly message for displaying in DEPNotify if that is integrated. - Changed logic if `IGNORE_APP_STORE_APPS=yes`. Before this version a label like `microsoftonedrive` that was installed from App Store, and that we want to replace with the “ordinary” version, Installomator would still use `updateTool`, even though `IGNORE_APP_STORE_APPS=yes`. So we would have to have `INSTALL=force` in order to have the app replaced, as `updateTool` would be used. But now if `IGNORE_APP_STORE_APPS=yes` then `updateTool` will be not set, and the App Store app will be replaced. BUT if the installed software was not from App Store, then `updateTool` will not be used, and it would be a kind of a forced install (in the example of `microsoftonedrive`), except if the version is the same (where installation is skipped). - Added variable `SYSTEMOWNER` that is used when copying files when installing. Default `0` is to change owner of the app to the current user on the Mac, like this user was installing this app themselves. When using `1` we will put “root:wheel” on the app, which can be useful for shared machines. +- Installomator will normally use `curl`without any headers to download files. But in the `buildLabel.sh` script it was necessary to add extra headers to get the correct download URLs from some servers, and as we get more experienced, various servers require different headers. In this version 3 set of extra headers has been added, so a download will be tried 4 times, but with different headers. Same sets of headers are also in `buildLabel.sh` in the same order. That has made it possible for the "mocha"-software-labels to work. ## v8.0 diff --git a/fragments/disabled/mochakeyboard.sh b/fragments/labels/mochakeyboard.sh similarity index 100% rename from fragments/disabled/mochakeyboard.sh rename to fragments/labels/mochakeyboard.sh diff --git a/fragments/disabled/mochatelnet.sh b/fragments/labels/mochatelnet.sh similarity index 100% rename from fragments/disabled/mochatelnet.sh rename to fragments/labels/mochatelnet.sh diff --git a/fragments/disabled/mochatn3270.sh b/fragments/labels/mochatn3270.sh similarity index 100% rename from fragments/disabled/mochatn3270.sh rename to fragments/labels/mochatn3270.sh diff --git a/fragments/disabled/mochatn3812.sh b/fragments/labels/mochatn3812.sh similarity index 100% rename from fragments/disabled/mochatn3812.sh rename to fragments/labels/mochatn3812.sh diff --git a/fragments/disabled/mochatn5250.sh b/fragments/labels/mochatn5250.sh similarity index 100% rename from fragments/disabled/mochatn5250.sh rename to fragments/labels/mochatn5250.sh diff --git a/fragments/main.sh b/fragments/main.sh index 2eb8781..ac036ad 100644 --- a/fragments/main.sh +++ b/fragments/main.sh @@ -168,7 +168,7 @@ fi if [ -f "$archiveName" ] && [ "$DEBUG" -eq 1 ]; then printlog "$archiveName exists and DEBUG mode 1 enabled, skipping download" else - # download the dmg + # download printlog "Downloading $downloadURL to $archiveName" if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then printlog "notifying" @@ -178,25 +178,64 @@ else displaynotification "Downloading new $name" "Download in progress …" fi fi - if ! curl --location --fail --silent "$downloadURL" -o "$archiveName"; then - if ! curl -fsL -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" -H "accept-encoding: gzip, deflate, br" -H "upgrade-insecure-requests: 1" -H "sec-fetch-dest: document" -H "sec-gpc: 1" -H "sec-fetch-user: ?1" -H "accept-language: en-US,en;q=0.9" -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" -H "sec-fetch-mode: navigate" "$downloadURL" -o "$archiveName"; then - if ! curl -fsL -H "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36" -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" -H "accept-encoding: gzip, deflate, br" -H "accept-language: en-US,en;q=0.9" -H "sec-fetch-dest: document" -H "sec-fetch-mode: navigate" -H "sec-fetch-site: same-site" -H "sec-fetch-user: ?1" -H "sec-gpc: 1" -H "upgrade-insecure-requests: 1" "$downloadURL" -o "$archiveName"; then - printlog "error downloading $downloadURL" - message="$name update/installation failed. This will be logged, so IT can follow up." - if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then - printlog "notifying" - if [[ $updateDetected == "YES" ]]; then - displaynotification "$message" "Error updating $name" - else - displaynotification "$message" "Error installing $name" + if ! curl -fsL "$downloadURL" -o "$archiveName"; then + printlog "Trying 1st set of extra headers to download." + if ! \ + curl -fsL \ + -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" \ + -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" \ + -H "accept-encoding: gzip, deflate, br" \ + -H "accept-language: en-US,en;q=0.9" \ + -H "sec-fetch-dest: document" \ + -H "sec-fetch-mode: navigate" \ + -H "sec-fetch-user: ?1" \ + -H "sec-gpc: 1" \ + -H "upgrade-insecure-requests: 1" \ + "$downloadURL" -o "$archiveName" + then + printlog "Trying 2nd set of extra headers to download." + if ! \ + curl -fsL \ + -H "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36" \ + -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" \ + -H "accept-encoding: gzip, deflate, br" \ + -H "accept-language: en-US,en;q=0.9" \ + -H "sec-fetch-dest: document" \ + -H "sec-fetch-mode: navigate" \ + -H "sec-fetch-site: same-site" \ + -H "sec-fetch-user: ?1" \ + -H "sec-gpc: 1" \ + -H "upgrade-insecure-requests: 1" \ + "$downloadURL" -o "$archiveName" + then + printlog "Trying 3rd set of extra headers to download." + if ! \ + curl -fsL \ + -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" \ + -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" \ + -H "accept-encoding: gzip, deflate, br" \ + -H "accept-language: en-US,en;q=0.9" \ + -H "sec-fetch-dest: document" \ + -H "sec-fetch-mode: navigate" \ + -H "sec-fetch-user: ?1" \ + -H "sec-gpc: 1" \ + -H "upgrade-insecure-requests: 1" \ + -H "Referrer Policy: strict-origin-when-cross-origin" \ + "$downloadURL" -o "$archiveName" + then + printlog "error downloading $downloadURL" + message="$name update/installation failed. This will be logged, so IT can follow up." + if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then + printlog "notifying" + if [[ $updateDetected == "YES" ]]; then + displaynotification "$message" "Error updating $name" + else + displaynotification "$message" "Error installing $name" + fi fi + cleanupAndExit 2 fi - cleanupAndExit 2 - else - printlog "Downloaded with all headers." fi - else - printlog "Downloaded with exta headers." fi fi fi diff --git a/utils/buildLabel.sh b/utils/buildLabel.sh index 8f96e3c..3dd8a5d 100755 --- a/utils/buildLabel.sh +++ b/utils/buildLabel.sh @@ -153,32 +153,105 @@ echo "Downloading $downloadURL" echo $(basename $downloadURL) # First trying to find redirection headers on the download, as those can contain version numbers echo "Redirecting to (maybe this can help us with version):\n$(curl -fsIL -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" -H "accept-encoding: gzip, deflate, br" -H "Referrer Policy: strict-origin-when-cross-origin" -H "upgrade-insecure-requests: 1" -H "sec-fetch-dest: document" -H "sec-gpc: 1" -H "sec-fetch-user: ?1" -H "accept-language: en-US,en;q=0.9" -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" -H "sec-fetch-mode: navigate" "$downloadURL" | grep -i "^[location|x\-amz\-meta\-version]*")" -# Now downloading without extra headers -if ! downloadOut="$(curl -fL "$downloadURL" --remote-header-name --remote-name -w "%{filename_effective}\n%{url_effective}\n")"; then - echo "error downloading $downloadURL using standard headers." - echo "result: $downloadOut" - echo "Trying all headers…" # that I know of - if ! downloadOut="$(curl -fL -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" -H "accept-encoding: gzip, deflate, br" -H "Referrer Policy: strict-origin-when-cross-origin" -H "upgrade-insecure-requests: 1" -H "sec-fetch-dest: document" -H "sec-gpc: 1" -H "sec-fetch-user: ?1" -H "accept-language: en-US,en;q=0.9" -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" -H "sec-fetch-mode: navigate" "$downloadURL" --remote-header-name --remote-name -w "%{filename_effective}\n%{url_effective}\n")"; then - echo "Trying almost all headers…" # that I know of - if ! downloadOut="$(curl -fL -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" -H "accept-encoding: gzip, deflate, br" -H "upgrade-insecure-requests: 1" -H "sec-fetch-dest: document" -H "sec-gpc: 1" -H "sec-fetch-user: ?1" -H "accept-language: en-US,en;q=0.9" -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" -H "sec-fetch-mode: navigate" "$downloadURL" --remote-header-name --remote-name -w "%{filename_effective}\n%{url_effective}\n")"; then - # we are only here if the download failed - echo "error downloading $downloadURL using two different sets of headers." - echo "result: $downloadOut" - # Sometimes a server will give some results to the downloaded output - if [[ -n $downloadOut ]]; then - echo "Trying output of this…" - downloadURL="$(echo $downloadOut | tail -1)" - # Last chance for succes on this download - if ! downloadOut="$(curl -fL "$downloadURL" --remote-header-name --remote-name -w "%{filename_effective}\n%{url_effective}\n")"; then - echo "error downloading $downloadURL using previous output." - echo "result: $downloadOut" +# Now downloading without various sets of extra headers +if ! downloadOut1="$( \ +curl -fL "$downloadURL" --remote-header-name --remote-name \ +-w "%{filename_effective}\n%{url_effective}\n")" +then + echo "error downloading $downloadURL with no headers." + echo "result: $downloadOut1" + echo "Trying 1st set of extra headers to download." + if ! downloadOut2="$( \ + curl -fL \ + -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" \ + -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" \ + -H "accept-encoding: gzip, deflate, br" \ + -H "accept-language: en-US,en;q=0.9" \ + -H "sec-fetch-dest: document" \ + -H "sec-fetch-mode: navigate" \ + -H "sec-fetch-user: ?1" \ + -H "sec-gpc: 1" \ + -H "upgrade-insecure-requests: 1" \ + "$downloadURL" --remote-header-name --remote-name \ + -w "%{filename_effective}\n%{url_effective}\n")" + then + echo "error downloading $downloadURL with 1st set of headers." + echo "result: $downloadOut2" + echo "Trying 2nd set of extra headers to download." + if ! downloadOut3="$( \ + curl -fL \ + -H "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36" \ + -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" \ + -H "accept-encoding: gzip, deflate, br" \ + -H "accept-language: en-US,en;q=0.9" \ + -H "sec-fetch-dest: document" \ + -H "sec-fetch-mode: navigate" \ + -H "sec-fetch-site: same-site" \ + -H "sec-fetch-user: ?1" \ + -H "sec-gpc: 1" \ + -H "upgrade-insecure-requests: 1" \ + "$downloadURL" --remote-header-name --remote-name \ + -w "%{filename_effective}\n%{url_effective}\n")" + then + echo "error downloading $downloadURL with 2nd set of headers." + echo "result: $downloadOut3" + echo "Trying 3rd set of extra headers to download." + if ! downloadOut4="$( \ + curl -fL \ + -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" \ + -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" \ + -H "accept-encoding: gzip, deflate, br" \ + -H "accept-language: en-US,en;q=0.9" \ + -H "sec-fetch-dest: document" \ + -H "sec-fetch-mode: navigate" \ + -H "sec-fetch-user: ?1" \ + -H "sec-gpc: 1" \ + -H "upgrade-insecure-requests: 1" \ + -H "Referrer Policy: strict-origin-when-cross-origin" \ + "$downloadURL" --remote-header-name --remote-name \ + -w "%{filename_effective}\n%{url_effective}\n")" + then + # we are only here if the download failed + echo "error downloading $downloadURL with 3rd set of headers." + echo "result: $downloadOut4" + echo "no more header sets to try" + # Sometimes a server will give some results to the downloaded output + echo "If any information came out of the previous download attempts, we can try those…" + downloadOuts=( "$downloadOut1" "$downloadOut3" "$downloadOut3" "$downloadOut4" ) + downloadOutCount=${#downloadOuts} + for downloadOut in $downloadOuts ; do + if [[ -n $downloadOut ]]; then + echo "Trying output of this…" + downloadURL="$(echo $downloadOut | tail -1)" + # Last chance for succes on this download + if ! downloadOut="$(curl -fL "$downloadURL" --remote-header-name --remote-name -w "%{filename_effective}\n%{url_effective}\n")"; then + echo "error downloading $downloadURL using previous output." + echo "result: $downloadOut" + ((downloadOutCount--)) + else + echo "Success on this download." + succesDownloadOut=$downloadOut + return + fi + fi + done + if [[ $downloadOutCount -eq 0 ]]; then echo "No more tries. Cannot continue." exit 1 fi + else + succesDownloadOut=$downloadOut4 fi + else + succesDownloadOut=$downloadOut3 fi + else + succesDownloadOut=$downloadOut2 fi +else + succesDownloadOut=$downloadOut1 fi +downloadOut=$succesDownloadOut # Now we have downloaded the archive, and we need to analyze this # The download have returned both {filename_effective} and {url_effective} From 732181c3a6807a21e2e90694031e86d32cc6798c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Tue, 11 Jan 2022 11:42:29 +0100 Subject: [PATCH 03/21] Delete main.sh --- fragments/main.sh | 305 ---------------------------------------------- 1 file changed, 305 deletions(-) delete mode 100644 fragments/main.sh diff --git a/fragments/main.sh b/fragments/main.sh deleted file mode 100644 index ac036ad..0000000 --- a/fragments/main.sh +++ /dev/null @@ -1,305 +0,0 @@ -*) - # unknown label - #printlog "unknown label $label" - cleanupAndExit 1 "unknown label $label" - ;; -esac - -# Are we only asked to return label name -if [[ $RETURN_LABEL_NAME -eq 1 ]]; then - printlog "Only returning label name." - printlog "$name" - echo "$name" - exit -fi - -# MARK: application download and installation starts here - -printlog "BLOCKING_PROCESS_ACTION=${BLOCKING_PROCESS_ACTION}" -printlog "NOTIFY=${NOTIFY}" - -# Finding LOGO to use in dialogs -case $LOGO in - appstore) - # Apple App Store on Mac - if [[ $(sw_vers -buildVersion) > "19" ]]; then - LOGO="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns" - else - LOGO="/Applications/App Store.app/Contents/Resources/AppIcon.icns" - fi - ;; - jamf) - # Jamf Pro - LOGO="/Library/Application Support/JAMF/Jamf.app/Contents/Resources/AppIcon.icns" - ;; - mosyleb) - # Mosyle Business - LOGO="/Applications/Self-Service.app/Contents/Resources/AppIcon.icns" - ;; - mosylem) - # Mosyle Manager (education) - LOGO="/Applications/Manager.app/Contents/Resources/AppIcon.icns" - ;; - addigy) - # Addigy - LOGO="/Library/Addigy/macmanage/MacManage.app/Contents/Resources/atom.icns" - ;; -esac -if [[ ! -a "${LOGO}" ]]; then - if [[ $(sw_vers -buildVersion) > "19" ]]; then - LOGO="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns" - else - LOGO="/Applications/App Store.app/Contents/Resources/AppIcon.icns" - fi -fi -printlog "LOGO=${LOGO}" - -# MARK: extract info from data -if [ -z "$archiveName" ]; then - case $type in - dmg|pkg|zip|tbz) - archiveName="${name}.$type" - ;; - pkgInDmg) - archiveName="${name}.dmg" - ;; - *InZip) - archiveName="${name}.zip" - ;; - updateronly) - ;; - *) - printlog "Cannot handle type $type" - cleanupAndExit 99 - ;; - esac -fi - -if [ -z "$appName" ]; then - # when not given derive from name - appName="$name.app" -fi - -if [ -z "$targetDir" ]; then - case $type in - dmg|zip|tbz|app*) - targetDir="/Applications" - ;; - pkg*) - targetDir="/" - ;; - updateronly) - ;; - *) - printlog "Cannot handle type $type" - cleanupAndExit 99 - ;; - esac -fi - -if [[ -z $blockingProcesses ]]; then - printlog "no blocking processes defined, using $name as default" - blockingProcesses=( $name ) -fi - -# MARK: determine tmp dir -if [ "$DEBUG" -eq 1 ]; then - # for debugging use script dir as working directory - tmpDir=$(dirname "$0") -else - # create temporary working directory - tmpDir=$(mktemp -d ) -fi - -# MARK: change directory to temporary working directory -printlog "Changing directory to $tmpDir" -if ! cd "$tmpDir"; then - printlog "error changing directory $tmpDir" - cleanupAndExit 1 -fi - -# MARK: get installed version -getAppVersion -printlog "appversion: $appversion" - -# MARK: Exit if new version is the same as installed version (appNewVersion specified) -if [[ "$type" != "updateronly" && ($INSTALL == "force" || $IGNORE_APP_STORE_APPS == "yes") ]]; then - printlog "Label is not of type “updateronly”, and it’s set to use force to install or ignoring app store apps, so not using updateTool." - updateTool="" -fi -if [[ -n $appNewVersion ]]; then - printlog "Latest version of $name is $appNewVersion" - if [[ $appversion == $appNewVersion ]]; then - if [[ $DEBUG -ne 1 ]]; then - printlog "There is no newer version available." - if [[ $INSTALL != "force" ]]; then - message="$name, version $appNewVersion, is the latest version." - if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then - printlog "notifying" - displaynotification "$message" "No update for $name!" - fi - cleanupAndExit 0 "No newer version." - fi - else - printlog "DEBUG mode 1 enabled, not exiting, but there is no new version of app." - fi - fi -else - printlog "Latest version not specified." -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 -ne 1 ]]; 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 1 enabled, not running update tool" - fi -fi - -# MARK: download the archive -if [ -f "$archiveName" ] && [ "$DEBUG" -eq 1 ]; then - printlog "$archiveName exists and DEBUG mode 1 enabled, skipping download" -else - # download - printlog "Downloading $downloadURL to $archiveName" - if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then - printlog "notifying" - if [[ $updateDetected == "YES" ]]; then - displaynotification "Downloading $name update" "Download in progress …" - else - displaynotification "Downloading new $name" "Download in progress …" - fi - fi - if ! curl -fsL "$downloadURL" -o "$archiveName"; then - printlog "Trying 1st set of extra headers to download." - if ! \ - curl -fsL \ - -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" \ - -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" \ - -H "accept-encoding: gzip, deflate, br" \ - -H "accept-language: en-US,en;q=0.9" \ - -H "sec-fetch-dest: document" \ - -H "sec-fetch-mode: navigate" \ - -H "sec-fetch-user: ?1" \ - -H "sec-gpc: 1" \ - -H "upgrade-insecure-requests: 1" \ - "$downloadURL" -o "$archiveName" - then - printlog "Trying 2nd set of extra headers to download." - if ! \ - curl -fsL \ - -H "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36" \ - -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" \ - -H "accept-encoding: gzip, deflate, br" \ - -H "accept-language: en-US,en;q=0.9" \ - -H "sec-fetch-dest: document" \ - -H "sec-fetch-mode: navigate" \ - -H "sec-fetch-site: same-site" \ - -H "sec-fetch-user: ?1" \ - -H "sec-gpc: 1" \ - -H "upgrade-insecure-requests: 1" \ - "$downloadURL" -o "$archiveName" - then - printlog "Trying 3rd set of extra headers to download." - if ! \ - curl -fsL \ - -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" \ - -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" \ - -H "accept-encoding: gzip, deflate, br" \ - -H "accept-language: en-US,en;q=0.9" \ - -H "sec-fetch-dest: document" \ - -H "sec-fetch-mode: navigate" \ - -H "sec-fetch-user: ?1" \ - -H "sec-gpc: 1" \ - -H "upgrade-insecure-requests: 1" \ - -H "Referrer Policy: strict-origin-when-cross-origin" \ - "$downloadURL" -o "$archiveName" - then - printlog "error downloading $downloadURL" - message="$name update/installation failed. This will be logged, so IT can follow up." - if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then - printlog "notifying" - if [[ $updateDetected == "YES" ]]; then - displaynotification "$message" "Error updating $name" - else - displaynotification "$message" "Error installing $name" - fi - fi - cleanupAndExit 2 - fi - fi - fi - fi -fi - -# MARK: when user is logged in, and app is running, prompt user to quit app -if [[ $BLOCKING_PROCESS_ACTION == "ignore" ]]; then - printlog "ignoring blocking processes" -else - if [[ $currentUser != "loginwindow" ]]; then - if [[ ${#blockingProcesses} -gt 0 ]]; then - if [[ ${blockingProcesses[1]} != "NONE" ]]; then - checkRunningProcesses - fi - fi - fi -fi - -# MARK: install the download -printlog "Installing $name" -if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then - printlog "notifying" - if [[ $updateDetected == "YES" ]]; then - displaynotification "Updating $name" "Installation in progress …" - else - displaynotification "Installing $name" "Installation in progress …" - fi -fi - -if [ -n "$installerTool" ]; then - # installerTool defined, and we use that for installation - printlog "installerTool used: $installerTool" - appName="$installerTool" -fi - -case $type in - dmg) - installFromDMG - ;; - pkg) - installFromPKG - ;; - zip) - installFromZIP - ;; - tbz) - installFromTBZ - ;; - pkgInDmg) - installPkgInDmg - ;; - pkgInZip) - installPkgInZip - ;; - appInDmgInZip) - installAppInDmgInZip - ;; - *) - printlog "Cannot handle type $type" - cleanupAndExit 99 - ;; -esac - -# MARK: Finishing — print installed application location and version -finishing - -# all done! -cleanupAndExit 0 From 01eabca204c2c82ef05622e31f68e116163829ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Tue, 11 Jan 2022 11:54:54 +0100 Subject: [PATCH 04/21] Introducing `curlOptions` to labels. --- CHANGELOG.md | 2 +- fragments/labels/mochatn3270.sh | 9 ++ fragments/main.sh | 258 ++++++++++++++++++++++++++++++++ 3 files changed, 268 insertions(+), 1 deletion(-) create mode 100644 fragments/main.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 11f3056..ff2cfcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ - New variable `RETURN_LABEL_NAME`. If given the value `1`, like `RETURN_LABEL_NAME=1` then Installomator only returns the name of the label. It makes for a better user friendly message for displaying in DEPNotify if that is integrated. - Changed logic if `IGNORE_APP_STORE_APPS=yes`. Before this version a label like `microsoftonedrive` that was installed from App Store, and that we want to replace with the “ordinary” version, Installomator would still use `updateTool`, even though `IGNORE_APP_STORE_APPS=yes`. So we would have to have `INSTALL=force` in order to have the app replaced, as `updateTool` would be used. But now if `IGNORE_APP_STORE_APPS=yes` then `updateTool` will be not set, and the App Store app will be replaced. BUT if the installed software was not from App Store, then `updateTool` will not be used, and it would be a kind of a forced install (in the example of `microsoftonedrive`), except if the version is the same (where installation is skipped). - Added variable `SYSTEMOWNER` that is used when copying files when installing. Default `0` is to change owner of the app to the current user on the Mac, like this user was installing this app themselves. When using `1` we will put “root:wheel” on the app, which can be useful for shared machines. -- Installomator will normally use `curl`without any headers to download files. But in the `buildLabel.sh` script it was necessary to add extra headers to get the correct download URLs from some servers, and as we get more experienced, various servers require different headers. In this version 3 set of extra headers has been added, so a download will be tried 4 times, but with different headers. Same sets of headers are also in `buildLabel.sh` in the same order. That has made it possible for the "mocha"-software-labels to work. +- Added option `curlOptions` to the labels. It can be filled with extra headers need for downloading the specific software. See “mocha”-software-labels. By default Installomator use `curl` without any headers to download files, but in the `buildLabel.sh` script it was necessary to add extra headers to get the correct download URLs from some servers, and as we get more experienced, various servers require different headers. So 3 different sets of headers have been added to `buildLabel.sh` so a download will be tried 4 times. Browsers like Safari and Brave can be used to inspect which headers are needed for software to donwload. ## v8.0 diff --git a/fragments/labels/mochatn3270.sh b/fragments/labels/mochatn3270.sh index 74ce410..b375fc6 100644 --- a/fragments/labels/mochatn3270.sh +++ b/fragments/labels/mochatn3270.sh @@ -3,5 +3,14 @@ mochatn3270) type="appInDmgInZip" downloadURL="https://mochasoft.dk/tn3270.dmg.zip" appNewVersion="" + curlOptions="-H \"User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15\" \ +-H \"accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\" \ +-H \"accept-encoding: gzip, deflate, br\" \ +-H \"accept-language: en-US,en;q=0.9\" \ +-H \"sec-fetch-dest: document\" \ +-H \"sec-fetch-mode: navigate\" \ +-H \"sec-fetch-user: ?1\" \ +-H \"sec-gpc: 1\" \ +-H \"upgrade-insecure-requests: 1\" " expectedTeamID="RR9F5EPNVW" ;; diff --git a/fragments/main.sh b/fragments/main.sh new file mode 100644 index 0000000..71994af --- /dev/null +++ b/fragments/main.sh @@ -0,0 +1,258 @@ +*) + # unknown label + #printlog "unknown label $label" + cleanupAndExit 1 "unknown label $label" + ;; +esac + +# Are we only asked to return label name +if [[ $RETURN_LABEL_NAME -eq 1 ]]; then + printlog "Only returning label name." + printlog "$name" + echo "$name" + exit +fi + +# MARK: application download and installation starts here + +printlog "BLOCKING_PROCESS_ACTION=${BLOCKING_PROCESS_ACTION}" +printlog "NOTIFY=${NOTIFY}" + +# Finding LOGO to use in dialogs +case $LOGO in + appstore) + # Apple App Store on Mac + if [[ $(sw_vers -buildVersion) > "19" ]]; then + LOGO="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns" + else + LOGO="/Applications/App Store.app/Contents/Resources/AppIcon.icns" + fi + ;; + jamf) + # Jamf Pro + LOGO="/Library/Application Support/JAMF/Jamf.app/Contents/Resources/AppIcon.icns" + ;; + mosyleb) + # Mosyle Business + LOGO="/Applications/Self-Service.app/Contents/Resources/AppIcon.icns" + ;; + mosylem) + # Mosyle Manager (education) + LOGO="/Applications/Manager.app/Contents/Resources/AppIcon.icns" + ;; + addigy) + # Addigy + LOGO="/Library/Addigy/macmanage/MacManage.app/Contents/Resources/atom.icns" + ;; +esac +if [[ ! -a "${LOGO}" ]]; then + if [[ $(sw_vers -buildVersion) > "19" ]]; then + LOGO="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns" + else + LOGO="/Applications/App Store.app/Contents/Resources/AppIcon.icns" + fi +fi +printlog "LOGO=${LOGO}" + +# MARK: extract info from data +if [ -z "$archiveName" ]; then + case $type in + dmg|pkg|zip|tbz) + archiveName="${name}.$type" + ;; + pkgInDmg) + archiveName="${name}.dmg" + ;; + *InZip) + archiveName="${name}.zip" + ;; + updateronly) + ;; + *) + printlog "Cannot handle type $type" + cleanupAndExit 99 + ;; + esac +fi + +if [ -z "$appName" ]; then + # when not given derive from name + appName="$name.app" +fi + +if [ -z "$targetDir" ]; then + case $type in + dmg|zip|tbz|app*) + targetDir="/Applications" + ;; + pkg*) + targetDir="/" + ;; + updateronly) + ;; + *) + printlog "Cannot handle type $type" + cleanupAndExit 99 + ;; + esac +fi + +if [[ -z $blockingProcesses ]]; then + printlog "no blocking processes defined, using $name as default" + blockingProcesses=( $name ) +fi + +# MARK: determine tmp dir +if [ "$DEBUG" -eq 1 ]; then + # for debugging use script dir as working directory + tmpDir=$(dirname "$0") +else + # create temporary working directory + tmpDir=$(mktemp -d ) +fi + +# MARK: change directory to temporary working directory +printlog "Changing directory to $tmpDir" +if ! cd "$tmpDir"; then + printlog "error changing directory $tmpDir" + cleanupAndExit 1 +fi + +# MARK: get installed version +getAppVersion +printlog "appversion: $appversion" + +# MARK: Exit if new version is the same as installed version (appNewVersion specified) +if [[ "$type" != "updateronly" && ($INSTALL == "force" || $IGNORE_APP_STORE_APPS == "yes") ]]; then + printlog "Label is not of type “updateronly”, and it’s set to use force to install or ignoring app store apps, so not using updateTool." + updateTool="" +fi +if [[ -n $appNewVersion ]]; then + printlog "Latest version of $name is $appNewVersion" + if [[ $appversion == $appNewVersion ]]; then + if [[ $DEBUG -ne 1 ]]; then + printlog "There is no newer version available." + if [[ $INSTALL != "force" ]]; then + message="$name, version $appNewVersion, is the latest version." + if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then + printlog "notifying" + displaynotification "$message" "No update for $name!" + fi + cleanupAndExit 0 "No newer version." + fi + else + printlog "DEBUG mode 1 enabled, not exiting, but there is no new version of app." + fi + fi +else + printlog "Latest version not specified." +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 -ne 1 ]]; 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 1 enabled, not running update tool" + fi +fi + +# MARK: download the archive +if [ -f "$archiveName" ] && [ "$DEBUG" -eq 1 ]; then + printlog "$archiveName exists and DEBUG mode 1 enabled, skipping download" +else + # download + printlog "Downloading $downloadURL to $archiveName" + if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then + printlog "notifying" + if [[ $updateDetected == "YES" ]]; then + displaynotification "Downloading $name update" "Download in progress …" + else + displaynotification "Downloading new $name" "Download in progress …" + fi + fi + if ! curl -fsL ${=curlOptions} "$downloadURL" -o "$archiveName"; then + printlog "error downloading $downloadURL" + message="$name update/installation failed. This will be logged, so IT can follow up." + if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then + printlog "notifying" + if [[ $updateDetected == "YES" ]]; then + displaynotification "$message" "Error updating $name" + else + displaynotification "$message" "Error installing $name" + fi + fi + cleanupAndExit 2 + fi +fi + +# MARK: when user is logged in, and app is running, prompt user to quit app +if [[ $BLOCKING_PROCESS_ACTION == "ignore" ]]; then + printlog "ignoring blocking processes" +else + if [[ $currentUser != "loginwindow" ]]; then + if [[ ${#blockingProcesses} -gt 0 ]]; then + if [[ ${blockingProcesses[1]} != "NONE" ]]; then + checkRunningProcesses + fi + fi + fi +fi + +# MARK: install the download +printlog "Installing $name" +if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then + printlog "notifying" + if [[ $updateDetected == "YES" ]]; then + displaynotification "Updating $name" "Installation in progress …" + else + displaynotification "Installing $name" "Installation in progress …" + fi +fi + +if [ -n "$installerTool" ]; then + # installerTool defined, and we use that for installation + printlog "installerTool used: $installerTool" + appName="$installerTool" +fi + +case $type in + dmg) + installFromDMG + ;; + pkg) + installFromPKG + ;; + zip) + installFromZIP + ;; + tbz) + installFromTBZ + ;; + pkgInDmg) + installPkgInDmg + ;; + pkgInZip) + installPkgInZip + ;; + appInDmgInZip) + installAppInDmgInZip + ;; + *) + printlog "Cannot handle type $type" + cleanupAndExit 99 + ;; +esac + +# MARK: Finishing — print installed application location and version +finishing + +# all done! +cleanupAndExit 0 From bd07ee6c76c34b2e8edc2eaaf89c64bba34a7933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Tue, 11 Jan 2022 12:53:06 +0100 Subject: [PATCH 05/21] More to `curlOptions` --- README.md | 5 +++++ fragments/header.sh | 5 +++++ fragments/main.sh | 6 ++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 51e22c2..aaac96b 100644 --- a/README.md +++ b/README.md @@ -317,6 +317,11 @@ The URL from which to download the archive. The URL can be generated by a series of commands, for example when you need to parse an xml file for the latest URL. (See `bbedit`, `desktoppr`, or `omnigraffle` for examples.) Sometimes version differs between Intel and Apple Silicon versions. (See `brave`, `obsidian`, `omnidisksweeper`, or `notion`). +- `curlOptions`: (optional) +Options to the `curl` command, needed for `curl` to be able to download the software. +Usually used for adding extra headers that some servers need in order to serve the file. +(see “mocha”-labels, for examples). + - `appNewVersion` (optional, but recommended): Version of the downloaded software. If given, it will be compared to installed version, to see if download is different. diff --git a/fragments/header.sh b/fragments/header.sh index 36f8500..baea5b9 100644 --- a/fragments/header.sh +++ b/fragments/header.sh @@ -149,6 +149,11 @@ REOPEN="yes" # URL to download the dmg. # Can be generated with a series of commands (see BBEdit for an example). # +# - curlOptions: (optional) +# Options to the curl command, needed for curl to be able to download the software. +# Usually used for adding extra headers that some servers need in order to serve the file. +# (see “mocha”-labels, for examples). +# # - appNewVersion: (optional) # Version of the downloaded software. # If given, it will be compared to the installed version, to see if the download is different. diff --git a/fragments/main.sh b/fragments/main.sh index 71994af..96fdb0e 100644 --- a/fragments/main.sh +++ b/fragments/main.sh @@ -178,7 +178,9 @@ else displaynotification "Downloading new $name" "Download in progress …" fi fi - if ! curl -fsL ${=curlOptions} "$downloadURL" -o "$archiveName"; then + set -x + if ! curl -fsL ${curlOptions} "$downloadURL" -o "$archiveName"; then + set +x printlog "error downloading $downloadURL" message="$name update/installation failed. This will be logged, so IT can follow up." if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then @@ -192,7 +194,7 @@ else cleanupAndExit 2 fi fi - +set +x # MARK: when user is logged in, and app is running, prompt user to quit app if [[ $BLOCKING_PROCESS_ACTION == "ignore" ]]; then printlog "ignoring blocking processes" From 193d51d49fa4a6684b6564277f07b790c0e86187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Tue, 11 Jan 2022 16:32:18 +0100 Subject: [PATCH 06/21] `curlOptions` as array. --- README.md | 5 +++-- fragments/header.sh | 5 +++-- fragments/labels/mochakeyboard.sh | 9 +++++++++ fragments/labels/mochatelnet.sh | 9 +++++++++ fragments/labels/mochatn3270.sh | 18 +++++++++--------- fragments/labels/mochatn3812.sh | 9 +++++++++ fragments/labels/mochatn5250.sh | 9 +++++++++ 7 files changed, 51 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index aaac96b..f325f34 100644 --- a/README.md +++ b/README.md @@ -317,10 +317,11 @@ The URL from which to download the archive. The URL can be generated by a series of commands, for example when you need to parse an xml file for the latest URL. (See `bbedit`, `desktoppr`, or `omnigraffle` for examples.) Sometimes version differs between Intel and Apple Silicon versions. (See `brave`, `obsidian`, `omnidisksweeper`, or `notion`). -- `curlOptions`: (optional) +- `curlOptions`: (array, optional) Options to the `curl` command, needed for `curl` to be able to download the software. Usually used for adding extra headers that some servers need in order to serve the file. -(see “mocha”-labels, for examples). +`curlOptions=( -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" )` +(See “mocha”-labels, for examples on labels, and `buildLabel.sh` for header-examples.) - `appNewVersion` (optional, but recommended): Version of the downloaded software. diff --git a/fragments/header.sh b/fragments/header.sh index baea5b9..a514960 100644 --- a/fragments/header.sh +++ b/fragments/header.sh @@ -149,10 +149,11 @@ REOPEN="yes" # URL to download the dmg. # Can be generated with a series of commands (see BBEdit for an example). # -# - curlOptions: (optional) +# - curlOptions: (array, optional) # Options to the curl command, needed for curl to be able to download the software. # Usually used for adding extra headers that some servers need in order to serve the file. -# (see “mocha”-labels, for examples). +# curlOptions=( -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" ) +# (See “mocha”-labels, for examples on labels, and buildLabel.sh for header-examples.) # # - appNewVersion: (optional) # Version of the downloaded software. diff --git a/fragments/labels/mochakeyboard.sh b/fragments/labels/mochakeyboard.sh index 5f742a5..17445e0 100644 --- a/fragments/labels/mochakeyboard.sh +++ b/fragments/labels/mochakeyboard.sh @@ -2,6 +2,15 @@ mochakeyboard) name="Mocha Keyboard" type="appInDmgInZip" downloadURL="https://mochasoft.dk/mochakeyboard.dmg.zip" + curlOptions=( -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" +-H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" +-H "accept-encoding: gzip, deflate, br" +-H "accept-language: en-US,en;q=0.9" +-H "sec-fetch-dest: document" +-H "sec-fetch-mode: navigate" +-H "sec-fetch-user: ?1" +-H "sec-gpc: 1" +-H "upgrade-insecure-requests: 1" ) appNewVersion="" expectedTeamID="RR9F5EPNVW" ;; diff --git a/fragments/labels/mochatelnet.sh b/fragments/labels/mochatelnet.sh index 5eba112..b34d58f 100644 --- a/fragments/labels/mochatelnet.sh +++ b/fragments/labels/mochatelnet.sh @@ -2,6 +2,15 @@ mochatelnet) name="Telnet" type="appInDmgInZip" downloadURL="https://mochasoft.dk/telnet.dmg.zip" + curlOptions=( -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" +-H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" +-H "accept-encoding: gzip, deflate, br" +-H "accept-language: en-US,en;q=0.9" +-H "sec-fetch-dest: document" +-H "sec-fetch-mode: navigate" +-H "sec-fetch-user: ?1" +-H "sec-gpc: 1" +-H "upgrade-insecure-requests: 1" ) appNewVersion="" expectedTeamID="RR9F5EPNVW" ;; diff --git a/fragments/labels/mochatn3270.sh b/fragments/labels/mochatn3270.sh index b375fc6..4be205d 100644 --- a/fragments/labels/mochatn3270.sh +++ b/fragments/labels/mochatn3270.sh @@ -2,15 +2,15 @@ mochatn3270) name="TN3270" type="appInDmgInZip" downloadURL="https://mochasoft.dk/tn3270.dmg.zip" + curlOptions=( -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" +-H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" +-H "accept-encoding: gzip, deflate, br" +-H "accept-language: en-US,en;q=0.9" +-H "sec-fetch-dest: document" +-H "sec-fetch-mode: navigate" +-H "sec-fetch-user: ?1" +-H "sec-gpc: 1" +-H "upgrade-insecure-requests: 1" ) appNewVersion="" - curlOptions="-H \"User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15\" \ --H \"accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\" \ --H \"accept-encoding: gzip, deflate, br\" \ --H \"accept-language: en-US,en;q=0.9\" \ --H \"sec-fetch-dest: document\" \ --H \"sec-fetch-mode: navigate\" \ --H \"sec-fetch-user: ?1\" \ --H \"sec-gpc: 1\" \ --H \"upgrade-insecure-requests: 1\" " expectedTeamID="RR9F5EPNVW" ;; diff --git a/fragments/labels/mochatn3812.sh b/fragments/labels/mochatn3812.sh index 54f3884..e27a33e 100644 --- a/fragments/labels/mochatn3812.sh +++ b/fragments/labels/mochatn3812.sh @@ -2,6 +2,15 @@ mochatn3812) name="TN3812" type="appInDmgInZip" downloadURL="https://mochasoft.dk/tn3812.dmg.zip" + curlOptions=( -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" +-H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" +-H "accept-encoding: gzip, deflate, br" +-H "accept-language: en-US,en;q=0.9" +-H "sec-fetch-dest: document" +-H "sec-fetch-mode: navigate" +-H "sec-fetch-user: ?1" +-H "sec-gpc: 1" +-H "upgrade-insecure-requests: 1" ) appNewVersion="" expectedTeamID="Frydendal" ;; diff --git a/fragments/labels/mochatn5250.sh b/fragments/labels/mochatn5250.sh index ae8ccf2..2707120 100644 --- a/fragments/labels/mochatn5250.sh +++ b/fragments/labels/mochatn5250.sh @@ -2,6 +2,15 @@ mochatn5250) name="TN5250" type="appInDmgInZip" downloadURL="https://mochasoft.dk/tn5250.dmg.zip" + curlOptions=( -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" +-H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" +-H "accept-encoding: gzip, deflate, br" +-H "accept-language: en-US,en;q=0.9" +-H "sec-fetch-dest: document" +-H "sec-fetch-mode: navigate" +-H "sec-fetch-user: ?1" +-H "sec-gpc: 1" +-H "upgrade-insecure-requests: 1" ) appNewVersion="" expectedTeamID="RR9F5EPNVW" ;; From 1360b51eaeacc15db512e1a6ea03458b91b61cdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Tue, 11 Jan 2022 16:35:09 +0100 Subject: [PATCH 07/21] removed the debug `set -x` --- fragments/main.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fragments/main.sh b/fragments/main.sh index 96fdb0e..640c244 100644 --- a/fragments/main.sh +++ b/fragments/main.sh @@ -178,9 +178,7 @@ else displaynotification "Downloading new $name" "Download in progress …" fi fi - set -x if ! curl -fsL ${curlOptions} "$downloadURL" -o "$archiveName"; then - set +x printlog "error downloading $downloadURL" message="$name update/installation failed. This will be logged, so IT can follow up." if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then @@ -194,7 +192,7 @@ else cleanupAndExit 2 fi fi -set +x + # MARK: when user is logged in, and app is running, prompt user to quit app if [[ $BLOCKING_PROCESS_ACTION == "ignore" ]]; then printlog "ignoring blocking processes" From ca1759abd90a026ed0e46cdd807103925429d1d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Tue, 11 Jan 2022 18:37:34 +0100 Subject: [PATCH 08/21] Update checkLabels.sh --- utils/checkLabels.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/checkLabels.sh b/utils/checkLabels.sh index f9fdef1..33025ed 100755 --- a/utils/checkLabels.sh +++ b/utils/checkLabels.sh @@ -119,7 +119,7 @@ echo for label in $allLabels; do echo "########## $label" labelWarning=0; labelError=0; expectedExtension=""; URLextension="" - name=""; type=""; downloadURL=""; appNewVersion=""; expectedTeamID=""; blockingProcesses=""; updateTool=""; updateToolArguments=""; archiveName="" + name=""; type=""; downloadURL=""; curlOptions=""; appNewVersion=""; expectedTeamID=""; blockingProcesses=""; updateTool=""; updateToolArguments=""; archiveName="" #caseLabel if cat "${labels_dir}/${label}.sh" | grep -v -E '^[a-z0-9\_-]*(\)|\|\\)$' | grep -v ";;" > checkLabelCurrent.sh; then @@ -156,7 +156,7 @@ for label in $allLabels; do echo "Version: $appNewVersion" ; fi fi - if curl -sfL --output /dev/null -r 0-0 "$downloadURL" ; then + if curl -sfL ${curlOptions} --output /dev/null -r 0-0 "$downloadURL" ; then echo "${GREEN}OK: downloadURL works OK${NC}" if [[ $(echo "$downloadURL" | sed -E 's/.*\.([a-zA-Z]*)\s*/\1/g' ) == "${expectedExtension}" ]]; then echo "${GREEN}OK: download extension MATCH on ${expectedExtension}${NC}" From 59eaff7d26ae5149defbdb4fbf6c1a4d1c696baf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Tue, 11 Jan 2022 18:58:39 +0100 Subject: [PATCH 09/21] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff2cfcc..31e2ce7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ - New variable `RETURN_LABEL_NAME`. If given the value `1`, like `RETURN_LABEL_NAME=1` then Installomator only returns the name of the label. It makes for a better user friendly message for displaying in DEPNotify if that is integrated. - Changed logic if `IGNORE_APP_STORE_APPS=yes`. Before this version a label like `microsoftonedrive` that was installed from App Store, and that we want to replace with the “ordinary” version, Installomator would still use `updateTool`, even though `IGNORE_APP_STORE_APPS=yes`. So we would have to have `INSTALL=force` in order to have the app replaced, as `updateTool` would be used. But now if `IGNORE_APP_STORE_APPS=yes` then `updateTool` will be not set, and the App Store app will be replaced. BUT if the installed software was not from App Store, then `updateTool` will not be used, and it would be a kind of a forced install (in the example of `microsoftonedrive`), except if the version is the same (where installation is skipped). - Added variable `SYSTEMOWNER` that is used when copying files when installing. Default `0` is to change owner of the app to the current user on the Mac, like this user was installing this app themselves. When using `1` we will put “root:wheel” on the app, which can be useful for shared machines. -- Added option `curlOptions` to the labels. It can be filled with extra headers need for downloading the specific software. See “mocha”-software-labels. By default Installomator use `curl` without any headers to download files, but in the `buildLabel.sh` script it was necessary to add extra headers to get the correct download URLs from some servers, and as we get more experienced, various servers require different headers. So 3 different sets of headers have been added to `buildLabel.sh` so a download will be tried 4 times. Browsers like Safari and Brave can be used to inspect which headers are needed for software to donwload. +- Added option `curlOptions` to the labels. It can be filled with extra headers need for downloading the specific software. It needs to be an array, like `curlOptions=( )`. See “mocha”-software-labels. ## v8.0 From 0cdc780a5f19b689aace7556a66273e92c4b98cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Tue, 11 Jan 2022 19:06:50 +0100 Subject: [PATCH 10/21] Update checkLabels.sh --- utils/checkLabels.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/utils/checkLabels.sh b/utils/checkLabels.sh index 33025ed..b1a55f6 100755 --- a/utils/checkLabels.sh +++ b/utils/checkLabels.sh @@ -97,16 +97,19 @@ YELLOW='\033[1;33m' BLUE='\033[1;34m' NC='\033[0m' # No Color -# Labels with the $(arch) call for different versions for Intel and Apple Silicon should be listed here: -archLabels=( $(grep "\$(arch)" ${labels_dir}/* | awk '{print $1}' | sed -E 's/.*\/([a-z0-9\_-]*)\..*/\1/g'| uniq ) ) -echo "${BLUE}Labels with \"\$(arch)\" call:${NC}\n${archLabels}\n" - +# Has label(s) been given as arguments or not, and list those +# Figure out which ones of these include "${arch}" so those will be testet for both architectures if [[ $# -eq 0 ]]; then allLabels=( $(grep -h -E '^([a-z0-9\_-]*)(\)|\|\\)$' ${labels_dir}/*.sh | tr -d ')|\\' | sort) ) + archLabels=( $(grep "\$(arch)" ${labels_dir}/* | awk '{print $1}' | sed -E 's/.*\/([a-z0-9\_-]*)\..*/\1/g'| uniq ) ) else allLabels=( ${=@} ) + # Next line needs to be improved to only look through the labels given as arguments + archLabels=( $(grep "\$(arch)" ${labels_dir}/* | awk '{print $1}' | sed -E 's/.*\/([a-z0-9\_-]*)\..*/\1/g'| uniq ) ) fi echo "${BLUE}Total labels:${NC}\n${allLabels}\n" +echo "${BLUE}Labels with \"\$(arch)\" call:${NC}\n${archLabels}\n" + secondRoundLabels="" # variable for labels with $(arch) call in them countWarning=0 From 36b7148e308b806f9cb10cd6fc8f8c76eded7ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Tue, 11 Jan 2022 20:39:53 +0100 Subject: [PATCH 11/21] Update checkLabels.sh --- utils/checkLabels.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/utils/checkLabels.sh b/utils/checkLabels.sh index b1a55f6..5c080da 100755 --- a/utils/checkLabels.sh +++ b/utils/checkLabels.sh @@ -98,19 +98,32 @@ BLUE='\033[1;34m' NC='\033[0m' # No Color # Has label(s) been given as arguments or not, and list those -# Figure out which ones of these include "${arch}" so those will be testet for both architectures +# Figure out which ones of these include "$(arch)" so those will be testet for both i386 and arm64 architectures if [[ $# -eq 0 ]]; then allLabels=( $(grep -h -E '^([a-z0-9\_-]*)(\)|\|\\)$' ${labels_dir}/*.sh | tr -d ')|\\' | sort) ) archLabels=( $(grep "\$(arch)" ${labels_dir}/* | awk '{print $1}' | sed -E 's/.*\/([a-z0-9\_-]*)\..*/\1/g'| uniq ) ) else allLabels=( ${=@} ) - # Next line needs to be improved to only look through the labels given as arguments - archLabels=( $(grep "\$(arch)" ${labels_dir}/* | awk '{print $1}' | sed -E 's/.*\/([a-z0-9\_-]*)\..*/\1/g'| uniq ) ) + # Check if labels exist + for checkLabel in $allLabels; do + if [ ! $(ls ${labels_dir}/${checkLabel}.sh 2>/dev/null) ] ; then + # Remove label from array + allLabels=("${(@)allLabels:#$checkLabel}") + fi + done + # Figure out if labels has "$(arch)" in them + archLabels=( $allLabels ) + for checkLabel in $archLabels; do + if [ ! -n "$(grep "\$(arch)" ${labels_dir}/${checkLabel}.sh 2>/dev/null)" ] ; then + # Remove label from array + archLabels=("${(@)archLabels:#$checkLabel}") + fi + done fi + echo "${BLUE}Total labels:${NC}\n${allLabels}\n" echo "${BLUE}Labels with \"\$(arch)\" call:${NC}\n${archLabels}\n" - secondRoundLabels="" # variable for labels with $(arch) call in them countWarning=0 countError=0 From 6f229b0b8cf74a1d813c025e98e882daf7e87d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Tue, 11 Jan 2022 21:38:49 +0100 Subject: [PATCH 12/21] Update buildLabel.sh --- utils/buildLabel.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/buildLabel.sh b/utils/buildLabel.sh index 3dd8a5d..b5ca79f 100755 --- a/utils/buildLabel.sh +++ b/utils/buildLabel.sh @@ -231,7 +231,7 @@ then else echo "Success on this download." succesDownloadOut=$downloadOut - return + break 2 fi fi done From 504e8528cef75cd64fdcec5f75b060fc29b75a35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Tue, 11 Jan 2022 22:56:38 +0100 Subject: [PATCH 13/21] Update checkLabels.sh --- utils/checkLabels.sh | 61 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/utils/checkLabels.sh b/utils/checkLabels.sh index 5c080da..a06c155 100755 --- a/utils/checkLabels.sh +++ b/utils/checkLabels.sh @@ -125,13 +125,17 @@ echo "${BLUE}Total labels:${NC}\n${allLabels}\n" echo "${BLUE}Labels with \"\$(arch)\" call:${NC}\n${archLabels}\n" secondRoundLabels="" # variable for labels with $(arch) call in them +warningLabels="" # variable for labels with warnings +errorLabels="" # variable for labels with errors countWarning=0 countError=0 + +# Loop through the 2 architectures for fixedArch in i386 arm64; do echo "${BLUE}Architecture: $fixedArch${NC}" echo -# Go through all labels +# Loop through all labels for label in $allLabels; do echo "########## $label" labelWarning=0; labelError=0; expectedExtension=""; URLextension="" @@ -211,8 +215,21 @@ for label in $allLabels; do echo "${RED}-> !! ERROR in downloadURL${NC}" labelError=1 fi - if [[ $labelWarning != 0 ]]; then; echo "${YELLOW}########## Warning in label: $label${NC}"; ((countWarning++)); fi - if [[ $labelError != 0 ]]; then; echo "${RED}########## ERROR in label: $label${NC}"; ((countError++)); fi + if [[ $labelWarning != 0 ]]; then; echo "${YELLOW}########## Warning in label: $label${NC}"; ((countWarning++)); warningLabels+=( "$label" ); fi + if [[ $labelError != 0 ]]; then + echo "${RED}########## ERROR in label: $label${NC}" + echo "Testing using Installomator" + exit_status=$( . $repo_dir/assemble.sh $label DEBUG=2 INSTALL=force | grep exit | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' ) + if [[ ${exit_status} -eq 0 ]] ; then + echo "${GREEN}$label works fine!${NC}" + #errorLabels=("${(@)errorLabels:#$errorLabel}") + else + echo "${RED}$label NOT WORKING!${NC}" + ((countError++)) + errorLabels+=( "$label" ) + fi + + fi if (($archLabels[(Ie)$label])); then secondRoundLabels+=( "$label" ) @@ -222,10 +239,45 @@ for label in $allLabels; do fi echo done +# check errorLabels using Installomator +#echo "Testing – $errorLabels – using Installomator" +#if [[ countError > 0 ]]; then +# allLabels=( ${=errorLabels} ) +# for errorLabel in $errorLabels; do +# exit_status=$( . $repo_dir/assemble.sh $errorLabel DEBUG=2 INSTALL=force | grep exit | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' ) +# if [[ ${exit_status} -eq 0 ]] ; then +# echo "$errorLabel works fine" +# errorLabels=("${(@)errorLabels:#$errorLabel}") +# ((countError--)) +# fi +# done +#fi +if [[ $fixedArch == i386 ]] ; then + errorLabelsi386=( ${=errorLabels} ) +else + errorLabelsarm64=( ${=errorLabels} ) +fi +#eval errorLabels${fixedArch}="${errorLabels}" +errorLabels="" allLabels=( ${=secondRoundLabels} ) archLabels=() echo done +#errorLabels${fixedArch}=(${=errorLabels}) +# check errorLabels using Installomator +#echo "Testing – $errorLabels – using Installomator" +#if [[ countError > 0 ]]; then +# allLabels=( ${=errorLabels} ) +# for errorLabel in $errorLabels; do +# exit_status=$( . $repo_dir/assemble.sh $errorLabel DEBUG=2 INSTALL=force | grep exit | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' ) +# if [[ ${exit_status} -eq 0 ]] ; then +# echo "$errorLabel works fine" +# errorLabels=("${(@)errorLabels:#$errorLabel}") +# ((countError--)) +# fi +# done +#fi +#errorLabels2=( ${=errorLabels} ) rm checkLabelCurrent.sh @@ -234,11 +286,14 @@ rm checkLabelCurrent.sh if [[ countWarning > 0 ]]; then echo "${YELLOW}Warnings counted: $countWarning${NC}" + echo "${YELLOW}${warningLabels}${NC}" else echo "${GREEN}No warnings detected!${NC}" fi if [[ countError > 0 ]]; then echo "${RED}ERRORS counted: $countError${NC}" + echo "${RED}i386 : ${errorLabelsi386}${NC}" + echo "${RED}arm64: ${errorLabelsarm64}${NC}" else echo "${GREEN}No errors detected!${NC}" fi From 901ea4babd302bcebded8d11362112ef90c6017d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Tue, 11 Jan 2022 23:03:51 +0100 Subject: [PATCH 14/21] Update checkLabels.sh --- utils/checkLabels.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/checkLabels.sh b/utils/checkLabels.sh index a06c155..cb56173 100755 --- a/utils/checkLabels.sh +++ b/utils/checkLabels.sh @@ -219,7 +219,7 @@ for label in $allLabels; do if [[ $labelError != 0 ]]; then echo "${RED}########## ERROR in label: $label${NC}" echo "Testing using Installomator" - exit_status=$( . $repo_dir/assemble.sh $label DEBUG=2 INSTALL=force | grep exit | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' ) + exit_status=$( . $repo_dir/assemble.sh $label DEBUG=2 INSTALL=force BLOCKING_PROCESS_ACTION=ignore | grep exit | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' ) if [[ ${exit_status} -eq 0 ]] ; then echo "${GREEN}$label works fine!${NC}" #errorLabels=("${(@)errorLabels:#$errorLabel}") From cd0204bb044cc50dbce6794d8f7b21a641628f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Tue, 11 Jan 2022 23:05:53 +0100 Subject: [PATCH 15/21] Update checkLabels.sh --- utils/checkLabels.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/checkLabels.sh b/utils/checkLabels.sh index cb56173..cf776f8 100755 --- a/utils/checkLabels.sh +++ b/utils/checkLabels.sh @@ -284,13 +284,13 @@ rm checkLabelCurrent.sh #${SELFLOCATION}/Installomator.sh version #echo -if [[ countWarning > 0 ]]; then +if [[ countWarning -gt 0 ]]; then echo "${YELLOW}Warnings counted: $countWarning${NC}" echo "${YELLOW}${warningLabels}${NC}" else echo "${GREEN}No warnings detected!${NC}" fi -if [[ countError > 0 ]]; then +if [[ countError -gt 0 ]]; then echo "${RED}ERRORS counted: $countError${NC}" echo "${RED}i386 : ${errorLabelsi386}${NC}" echo "${RED}arm64: ${errorLabelsarm64}${NC}" From 4df1a6dbaa6298909ead63d96492235d5a2febe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Tue, 11 Jan 2022 23:39:55 +0100 Subject: [PATCH 16/21] canva and logitechoptions labels fixed --- fragments/labels/canva.sh | 8 +++++--- fragments/labels/logitechoptions.sh | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fragments/labels/canva.sh b/fragments/labels/canva.sh index f399d77..9e89ac9 100644 --- a/fragments/labels/canva.sh +++ b/fragments/labels/canva.sh @@ -2,10 +2,12 @@ canva) name="Canva" type="dmg" if [[ $(arch) == "arm64" ]]; then - downloadURL=$(curl -fsLI -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" -H "accept-encoding: gzip, deflate, br" -H "accept-language: en-US,en;q=0.9" -H "Referrer Policy: strict-origin-when-cross-origin" -H "upgrade-insecure-requests: 1" -H "sec-fetch-dest: document" -H "sec-gpc: 1" -H "sec-fetch-user: ?1" -H "sec-fetch-mode: navigate" -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" "https://www.canva.com/download/mac/arm/canva-desktop/" | grep -i "^location" | cut -d " " -f2 | tr -d '\r') + downloadURL=https://desktop-release.canva.com/$(curl -fs https://desktop-release.canva.com/latest-mac.yml | grep -e "url.*dmg" | grep -oe "Canva-[0-9.]*-arm64.dmg") + # https://www.canva.com/download/mac/arm/canva-desktop/ elif [[ $(arch) == "i386" ]]; then - downloadURL=$(curl -fsLI -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" -H "accept-encoding: gzip, deflate, br" -H "Referrer Policy: strict-origin-when-cross-origin" -H "upgrade-insecure-requests: 1" -H "sec-fetch-dest: document" -H "sec-gpc: 1" -H "sec-fetch-user: ?1" -H "accept-language: en-US,en;q=0.9" -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" -H "sec-fetch-mode: navigate" "https://www.canva.com/download/mac/intel/canva-desktop/" | grep -i "^location" | cut -d " " -f2 | tr -d '\r') + downloadURL=https://desktop-release.canva.com/$(curl -fs https://desktop-release.canva.com/latest-mac.yml | grep -e "url.*dmg" | grep -oe "Canva-[0-9.]*.dmg") + # https://www.canva.com/download/mac/intel/canva-desktop/ fi - appNewVersion=$( echo "${downloadURL}" | sed -E 's/.*\/[a-zA-Z]*-([0-9.]*)\..*/\1/g' ) + appNewVersion=$( curl -fs https://desktop-release.canva.com/latest-mac.yml | grep version | cut -d " " -f2 ) expectedTeamID="5HD2ARTBFS" ;; diff --git a/fragments/labels/logitechoptions.sh b/fragments/labels/logitechoptions.sh index 98bdf6b..c3cf225 100644 --- a/fragments/labels/logitechoptions.sh +++ b/fragments/labels/logitechoptions.sh @@ -1,8 +1,8 @@ logitechoptions) name="Logitech Options" type="pkgInZip" - downloadURL=$(curl -fs https://support.logi.com/api/v2/help_center/en-us/articles.json | tr "," "\n" | grep -A 10 "macOS" | grep -oie "https.*/.*/options.*\.zip") - appNewVersion=$(curl -fs https://support.logi.com/api/v2/help_center/en-us/articles.json | tr "," "\n" | grep -A 10 "macOS" | grep -B 5 -ie "https.*/.*/options.*\.zip" | grep "Software Version" | sed 's/\\u[0-9a-z][0-9a-z][0-9a-z][0-9a-z]//g' | grep -ioe "Software Version.*[0-9.]*" | tr "/" "\n" | grep -oe "[0-9.]*" | head -1) + downloadURL=$(curl -fs https://support.logi.com/api/v2/help_center/en-us/articles.json | tr "," "\n" | grep -A 10 "macOS" | grep -oie "https.*/.*/options/.*\.zip") + appNewVersion=$(curl -fs https://support.logi.com/api/v2/help_center/en-us/articles.json | tr "," "\n" | grep -A 10 "macOS" | grep -B 5 -ie "https.*/.*/options/.*\.zip" | grep "Software Version" | sed 's/\\u[0-9a-z][0-9a-z][0-9a-z][0-9a-z]//g' | grep -ioe "Software Version.*[0-9.]*" | tr "/" "\n" | grep -oe "[0-9.]*" | head -1) #pkgName="LogiMgr Installer "*".app/Contents/Resources/LogiMgr.pkg" pkgName=LogiMgr.pkg expectedTeamID="QED4VVPZWA" From 0fc7761fb9a21000b5ba9e3403561ac2c5d2389c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Wed, 12 Jan 2022 09:26:46 +0100 Subject: [PATCH 17/21] Label fixed --- fragments/labels/evernote.sh | 2 +- fragments/labels/golang.sh | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/fragments/labels/evernote.sh b/fragments/labels/evernote.sh index 85253e6..e65fe95 100644 --- a/fragments/labels/evernote.sh +++ b/fragments/labels/evernote.sh @@ -1,7 +1,7 @@ evernote) name="Evernote" type="dmg" - downloadURL=$(curl -fs -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15)" "https://evernote.com/download" | grep -i ".dmg" | cut -d '"' -f2) + downloadURL=$(curl -fs -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15)" "https://evernote.com/download" | grep -i ".dmg" | grep -ioe "href.*" | cut -d '"' -f2) appNewVersion=$( echo "${downloadURL}" | sed -E 's/.*\/[a-zA-Z]*-([0-9.]*)-.*/\1/g' ) expectedTeamID="Q79WDW8YH9" appName="Evernote.app" diff --git a/fragments/labels/golang.sh b/fragments/labels/golang.sh index 81b81f9..007c423 100644 --- a/fragments/labels/golang.sh +++ b/fragments/labels/golang.sh @@ -1,10 +1,9 @@ golang) - # credit: Søren Theilgaard (@theilgaard) name="GoLang" type="pkg" packageID="org.golang.go" - downloadURL="$(curl -fsIL "https://golang.org$(curl -fs "https://golang.org/dl/" | grep -i "downloadBox" | grep "pkg" | tr '"' '\n' | grep "pkg")" | grep -i "^location" | awk '{print $2}' | tr -d '\r\n')" - appNewVersion="$( echo "${downloadURL}" | sed -E 's/.*\/(go[0-9.]*)\..*/\1/g' )" # Version includes letters "go" + downloadURL="https://go.dev$(curl -fs "https://go.dev/dl/" | grep -i "downloadBox" | grep "pkg" | tr '"' '\n' | grep "pkg")" + appNewVersion="$( echo "${downloadURL}" | sed -E 's/.*\/(go[0-9.]*)\..*/\1/g' )" # Version includes letters "go" in the beginning expectedTeamID="EQHXZ8M8AV" blockingProcesses=( NONE ) ;; From c8071a2a63881582e91787bf681b20352a014b5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Wed, 12 Jan 2022 12:48:45 +0100 Subject: [PATCH 18/21] Create diskspace.sh --- fragments/labels/diskspace.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 fragments/labels/diskspace.sh diff --git a/fragments/labels/diskspace.sh b/fragments/labels/diskspace.sh new file mode 100644 index 0000000..ab8f88c --- /dev/null +++ b/fragments/labels/diskspace.sh @@ -0,0 +1,8 @@ +diskspace) + name="diskspace" + type="pkg" + packageID="com.scriptingosx.diskspace" + downloadURL="$(downloadURLFromGit scriptingosx diskspace)" + appNewVersion="$(versionFromGit scriptingosx diskspace)" + expectedTeamID="JME5BW3F3R" + ;; From da21ea85824af465ebff25168e7bd29dd0674cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Wed, 12 Jan 2022 12:53:07 +0100 Subject: [PATCH 19/21] Update checkLabels.sh Need `INSTAL=force` and `IGNORE_APP_STORE_APPS=yes` to be able test any title on any system. --- utils/checkLabels.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/checkLabels.sh b/utils/checkLabels.sh index cf776f8..eeba7a2 100755 --- a/utils/checkLabels.sh +++ b/utils/checkLabels.sh @@ -219,7 +219,7 @@ for label in $allLabels; do if [[ $labelError != 0 ]]; then echo "${RED}########## ERROR in label: $label${NC}" echo "Testing using Installomator" - exit_status=$( . $repo_dir/assemble.sh $label DEBUG=2 INSTALL=force BLOCKING_PROCESS_ACTION=ignore | grep exit | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' ) + exit_status=$( . $repo_dir/assemble.sh $label DEBUG=2 INSTALL=force IGNORE_APP_STORE_APPS=yes BLOCKING_PROCESS_ACTION=ignore | grep exit | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' ) if [[ ${exit_status} -eq 0 ]] ; then echo "${GREEN}$label works fine!${NC}" #errorLabels=("${(@)errorLabels:#$errorLabel}") From 180ca0952baf69584dfc03d30e732cde477572db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Wed, 12 Jan 2022 14:03:30 +0100 Subject: [PATCH 20/21] Update checkLabels.sh --- utils/checkLabels.sh | 231 +++++++++++++++++++------------------------ 1 file changed, 100 insertions(+), 131 deletions(-) diff --git a/utils/checkLabels.sh b/utils/checkLabels.sh index eeba7a2..fa6144b 100755 --- a/utils/checkLabels.sh +++ b/utils/checkLabels.sh @@ -3,7 +3,7 @@ export PATH=/usr/bin:/bin:/usr/sbin:/sbin # Check Installomator labels from fragments -# 2021 Søren Theilgaard (@theilgaard) +# 2021-2022 Søren Theilgaard (@theilgaard) # This script will test labels and check if download link is active, and if version is defined. # If labels are written to the script only those will be tested. @@ -132,158 +132,127 @@ countError=0 # Loop through the 2 architectures for fixedArch in i386 arm64; do -echo "${BLUE}Architecture: $fixedArch${NC}" -echo + echo "${BLUE}Architecture: $fixedArch${NC}" + echo -# Loop through all labels -for label in $allLabels; do - echo "########## $label" - labelWarning=0; labelError=0; expectedExtension=""; URLextension="" - name=""; type=""; downloadURL=""; curlOptions=""; appNewVersion=""; expectedTeamID=""; blockingProcesses=""; updateTool=""; updateToolArguments=""; archiveName="" - - #caseLabel - if cat "${labels_dir}/${label}.sh" | grep -v -E '^[a-z0-9\_-]*(\)|\|\\)$' | grep -v ";;" > checkLabelCurrent.sh; then - source checkLabelCurrent.sh + # Loop through all labels + for label in $allLabels; do + echo "########## $label" + labelWarning=0; labelError=0; expectedExtension=""; URLextension="" + name=""; type=""; downloadURL=""; curlOptions=""; appNewVersion=""; expectedTeamID=""; blockingProcesses=""; updateTool=""; updateToolArguments=""; archiveName="" + + #caseLabel + if cat "${labels_dir}/${label}.sh" | grep -v -E '^[a-z0-9\_-]*(\)|\|\\)$' | grep -v ";;" > checkLabelCurrent.sh; then + source checkLabelCurrent.sh - echo "Name: $name" - echo "Download URL: $downloadURL" - echo "Type: $type" - case $type in - dmg|pkg|zip|tbz) - expectedExtension="$type" - ;; - pkgInDmg) - expectedExtension="dmg" - ;; - *InZip) - expectedExtension="zip" - ;; - *) - echo "Cannot handle type $type" - ;; - esac - if [[ "$appNewVersion" == "" ]] ; then - echo "No appNewVersion!" - else - if [[ $( echo "$appNewVersion" | grep -i "[0-9.]" ) == "" || $appNewVersion == "" ]]; then - echo "${RED}-> !! ERROR in appNewVersion${NC}" - labelError=1 + echo "Name: $name" + echo "Download URL: $downloadURL" + echo "Type: $type" + case $type in + dmg|pkg|zip|tbz) + expectedExtension="$type" + ;; + pkgInDmg) + expectedExtension="dmg" + ;; + *InZip) + expectedExtension="zip" + ;; + *) + echo "Cannot handle type $type" + ;; + esac + if [[ "$appNewVersion" == "" ]] ; then + echo "No appNewVersion!" else - if [[ $appNewVersion != $( echo "$appNewVersion" | sed -E 's/[^0-9]*([0-9.]*)[^0-9]*/\1/g' ) ]]; then - echo "${YELLOW}Warning: Version contain not only numbers and dots.${NC}" - labelWarning=1 + if [[ $( echo "$appNewVersion" | grep -i "[0-9.]" ) == "" || $appNewVersion == "" ]]; then + echo "${RED}-> !! ERROR in appNewVersion${NC}" + labelError=1 + else + if [[ $appNewVersion != $( echo "$appNewVersion" | sed -E 's/[^0-9]*([0-9.]*)[^0-9]*/\1/g' ) ]]; then + echo "${YELLOW}Warning: Version contain not only numbers and dots.${NC}" + labelWarning=1 + fi + echo "Version: $appNewVersion" ; fi - echo "Version: $appNewVersion" ; fi - fi - if curl -sfL ${curlOptions} --output /dev/null -r 0-0 "$downloadURL" ; then - echo "${GREEN}OK: downloadURL works OK${NC}" - if [[ $(echo "$downloadURL" | sed -E 's/.*\.([a-zA-Z]*)\s*/\1/g' ) == "${expectedExtension}" ]]; then - echo "${GREEN}OK: download extension MATCH on ${expectedExtension}${NC}" - else - if [[ $(echo "$downloadURL" | grep -io "github.com") != "github.com" ]]; then - URLheader=$( curl -fsIL "$downloadURL" ) - if [[ "${URLheader}" != "" ]]; then - URLlocation=$( echo "${URLheader}" | grep -i "^location" ) - URLfilename=$( echo "${URLheader}" | grep -i "filename=" ) - if [[ "${URLlocation}" != "" ]]; then - URLextension=$( echo "${URLlocation}" | tail -1 | sed -E 's/.*\.([a-zA-Z]*)\s*/\1/g' | tr -d '\r\n' ) + if curl -sfL ${curlOptions} --output /dev/null -r 0-0 "$downloadURL" ; then + echo "${GREEN}OK: downloadURL works OK${NC}" + if [[ $(echo "$downloadURL" | sed -E 's/.*\.([a-zA-Z]*)\s*/\1/g' ) == "${expectedExtension}" ]]; then + echo "${GREEN}OK: download extension MATCH on ${expectedExtension}${NC}" + else + if [[ $(echo "$downloadURL" | grep -io "github.com") != "github.com" ]]; then + URLheader=$( curl -fsIL "$downloadURL" ) + if [[ "${URLheader}" != "" ]]; then + URLlocation=$( echo "${URLheader}" | grep -i "^location" ) + URLfilename=$( echo "${URLheader}" | grep -i "filename=" ) + if [[ "${URLlocation}" != "" ]]; then + URLextension=$( echo "${URLlocation}" | tail -1 | sed -E 's/.*\.([a-zA-Z]*)\s*/\1/g' | tr -d '\r\n' ) + else + URLextension=$( echo "${URLfilename}" | tail -1 | sed -E 's/.*\.([a-zA-Z]*)\s*/\1/g' | tr -d '\r\n' ) + fi + URLextension=${${URLextension:l}%%\?*} + if [[ "${URLextension}" == "${expectedExtension}" ]]; then + echo "${GREEN}OK: download extension MATCH on ${URLextension}${NC}" + else + echo "${RED}-> !! ERROR in download extension, expected ${expectedExtension}, but got ${URLextension}.${NC}" + labelError=1 + fi else - URLextension=$( echo "${URLfilename}" | tail -1 | sed -E 's/.*\.([a-zA-Z]*)\s*/\1/g' | tr -d '\r\n' ) + echo "no header provided from server." fi - URLextension=${${URLextension:l}%%\?*} - if [[ "${URLextension}" == "${expectedExtension}" ]]; then - echo "${GREEN}OK: download extension MATCH on ${URLextension}${NC}" + else + githubPart="$(echo "$downloadURL" | cut -d "/" -f4-6)" + if [[ "$(curl -fsL "$downloadURL" | grep -io "${githubPart}.*\.${expectedExtension}")" != "" ]]; then + echo "${GREEN}OK: download extension MATCH on ${expectedExtension}${NC}" else - echo "${RED}-> !! ERROR in download extension, expected ${expectedExtension}, but got ${URLextension}.${NC}" + echo "${RED}-> !! ERROR in download extension, expected ${expectedExtension}, but it was wrong${NC}" labelError=1 fi - else - echo "no header provided from server." - fi - else - githubPart="$(echo "$downloadURL" | cut -d "/" -f4-6)" - if [[ "$(curl -fsL "$downloadURL" | grep -io "${githubPart}.*\.${expectedExtension}")" != "" ]]; then - echo "${GREEN}OK: download extension MATCH on ${expectedExtension}${NC}" - else - echo "${RED}-> !! ERROR in download extension, expected ${expectedExtension}, but it was wrong${NC}" - labelError=1 fi fi + else + echo "${RED}-> !! ERROR in downloadURL${NC}" + labelError=1 + fi + if [[ $labelWarning != 0 ]]; then; echo "${YELLOW}########## Warning in label: $label${NC}"; ((countWarning++)); warningLabels+=( "$label" ); fi + if [[ $labelError != 0 ]]; then + echo "${RED}########## ERROR in label: $label${NC}" + echo "Testing using Installomator" + exit_status=$( . $repo_dir/assemble.sh $label DEBUG=2 INSTALL=force IGNORE_APP_STORE_APPS=yes BLOCKING_PROCESS_ACTION=ignore | grep exit | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' ) + if [[ ${exit_status} -eq 0 ]] ; then + echo "${GREEN}$label works fine!${NC}" + #errorLabels=("${(@)errorLabels:#$errorLabel}") + else + echo "${RED}$label NOT WORKING!${NC}" + ((countError++)) + errorLabels+=( "$label" ) + fi + + fi + + if (($archLabels[(Ie)$label])); then + secondRoundLabels+=( "$label" ) fi else - echo "${RED}-> !! ERROR in downloadURL${NC}" - labelError=1 - fi - if [[ $labelWarning != 0 ]]; then; echo "${YELLOW}########## Warning in label: $label${NC}"; ((countWarning++)); warningLabels+=( "$label" ); fi - if [[ $labelError != 0 ]]; then - echo "${RED}########## ERROR in label: $label${NC}" - echo "Testing using Installomator" - exit_status=$( . $repo_dir/assemble.sh $label DEBUG=2 INSTALL=force IGNORE_APP_STORE_APPS=yes BLOCKING_PROCESS_ACTION=ignore | grep exit | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' ) - if [[ ${exit_status} -eq 0 ]] ; then - echo "${GREEN}$label works fine!${NC}" - #errorLabels=("${(@)errorLabels:#$errorLabel}") - else - echo "${RED}$label NOT WORKING!${NC}" - ((countError++)) - errorLabels+=( "$label" ) - fi - - fi - - if (($archLabels[(Ie)$label])); then - secondRoundLabels+=( "$label" ) + echo "Label: ${label} is not it's own file in Labels-folder. Skipping" fi + echo + done + if [[ $fixedArch == i386 ]] ; then + errorLabelsi386=( ${=errorLabels} ) else - echo "Label: ${label} is not it's own file in Labels-folder. Skipping" + errorLabelsarm64=( ${=errorLabels} ) fi + + errorLabels="" + allLabels=( ${=secondRoundLabels} ) + archLabels=() echo done -# check errorLabels using Installomator -#echo "Testing – $errorLabels – using Installomator" -#if [[ countError > 0 ]]; then -# allLabels=( ${=errorLabels} ) -# for errorLabel in $errorLabels; do -# exit_status=$( . $repo_dir/assemble.sh $errorLabel DEBUG=2 INSTALL=force | grep exit | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' ) -# if [[ ${exit_status} -eq 0 ]] ; then -# echo "$errorLabel works fine" -# errorLabels=("${(@)errorLabels:#$errorLabel}") -# ((countError--)) -# fi -# done -#fi -if [[ $fixedArch == i386 ]] ; then - errorLabelsi386=( ${=errorLabels} ) -else - errorLabelsarm64=( ${=errorLabels} ) -fi -#eval errorLabels${fixedArch}="${errorLabels}" -errorLabels="" -allLabels=( ${=secondRoundLabels} ) -archLabels=() -echo -done -#errorLabels${fixedArch}=(${=errorLabels}) -# check errorLabels using Installomator -#echo "Testing – $errorLabels – using Installomator" -#if [[ countError > 0 ]]; then -# allLabels=( ${=errorLabels} ) -# for errorLabel in $errorLabels; do -# exit_status=$( . $repo_dir/assemble.sh $errorLabel DEBUG=2 INSTALL=force | grep exit | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' ) -# if [[ ${exit_status} -eq 0 ]] ; then -# echo "$errorLabel works fine" -# errorLabels=("${(@)errorLabels:#$errorLabel}") -# ((countError--)) -# fi -# done -#fi -#errorLabels2=( ${=errorLabels} ) rm checkLabelCurrent.sh -#${SELFLOCATION}/Installomator.sh version -#echo - if [[ countWarning -gt 0 ]]; then echo "${YELLOW}Warnings counted: $countWarning${NC}" echo "${YELLOW}${warningLabels}${NC}" From 197b34fe02c118be026cd787905b46c223044dca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Mon, 17 Jan 2022 15:40:03 +0100 Subject: [PATCH 21/21] Update buildLabel.sh --- utils/buildLabel.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/buildLabel.sh b/utils/buildLabel.sh index b5ca79f..a6de0c1 100755 --- a/utils/buildLabel.sh +++ b/utils/buildLabel.sh @@ -324,7 +324,7 @@ fi identifier=${name:l} # making lower case identifier=${identifier//\%[0-9a-fA-F][0-9a-fA-F]} # removing certain characters -identifier=${identifier//[,._*@$\(\)\-]} # removing more characters from label name +identifier=${identifier//[ ,._*@$\(\)\-]} # removing more characters from label name echo "identifier: $identifier" # github-part to figure out if we can find author and repo, to use our github functions for the label