This commit is contained in:
Søren Theilgaard
2021-08-27 11:18:05 +02:00
20 changed files with 334 additions and 53 deletions

1
.gitignore vendored
View File

@@ -11,3 +11,4 @@ scratch/
# do include Installomator .pkg files
#!Installomator-*.pkg
checkLabelCurrent.sh

View File

@@ -44,6 +44,7 @@ blender
bluejeans
boxdrive
boxtools
brave
caffeine
cakebrew
calibre
@@ -55,6 +56,7 @@ clickshare
code42
coderunner
colourcontrastanalyser
cormorant
cryptomator
cyberduck
dangerzone
@@ -128,6 +130,7 @@ jamfmigrator
jamfpppcutility
jamfreenroller
jetbrainsdatagrip
jetbrainsintellijidea
jetbrainsintellijideace
jetbrainsphpstorm
jetbrainspycharm
@@ -202,6 +205,7 @@ pdfsam
pitch
plantronicshub
platypus
plisteditpro
postman
prism9
privileges
@@ -227,7 +231,9 @@ royaltsx
rstudio
santa
scaleft
screamingfrogseospider
screencloudplayer
screenflick
sfsymbols
shield
sidekick

View File

@@ -131,7 +131,9 @@ googlechrome)
When you know how to extract these pieces of information from the application and/or download, then you can add an application to Installomator.
The script buildCaseStatement.sh can help with the label creation.
The script `buildCaseStatement.sh` can help with the label creation.
Please note: Labels should be named in small caps, numbers 0-9, “-”, and “_”. No other characters allowed.
### Not specific to a management system

View File

@@ -1,6 +1,7 @@
applesfsymbols|\
sfsymbols)
name="SF Symbols"
type="pkgInDmg"
downloadURL="https://developer.apple.com/design/downloads/SF-Symbols.dmg"
expectedTeamID="Software Update"
;;
;;

View File

@@ -0,0 +1,6 @@
boxsync)
name="Box Sync"
type="dmg"
downloadURL="https://e3.boxcdn.net/box-installers/sync/Sync+4+External/Box%20Sync%20Installer.dmg"
expectedTeamID="M683GB7CPW"
;;

View File

@@ -1,6 +1,6 @@
boxtools)
name="Box Tools"
type="pkg"
downloadURL="https://box-installers.s3.amazonaws.com/boxedit/mac/currentrelease/BoxToolsInstaller.pkg"
expectedTeamID="M683GB7CPW"
;;
name="Box Tools"
type="pkg"
downloadURL="https://box-installers.s3.amazonaws.com/boxedit/mac/currentrelease/BoxToolsInstaller.pkg"
expectedTeamID="M683GB7CPW"
;;

View File

@@ -1,8 +1,8 @@
colourcontrastanalyser)
name="Colour Contrast Analyser (CCA)"
type="dmg"
downloadURL=$(downloadURLFromGit ThePacielloGroup CCAe)
appNewVersion=$(versionFromGit ThePacielloGroup CCAe)
expectedTeamID="34RS4UC3M6"
blockingProcesses=( NONE )
;;
name="Colour Contrast Analyser (CCA)"
type="dmg"
downloadURL=$(downloadURLFromGit ThePacielloGroup CCAe)
appNewVersion=$(versionFromGit ThePacielloGroup CCAe)
expectedTeamID="34RS4UC3M6"
blockingProcesses=( NONE )
;;

View File

@@ -0,0 +1,8 @@
craftmanager)
name="CraftManager"
type="zip"
#downloadURL="https://craft-assets.invisionapp.com/CraftManager/production/CraftManager.zip"
downloadURL="$(curl -fs https://craft-assets.invisionapp.com/CraftManager/production/appcast.xml | xpath '(//rss/channel/item/enclosure/@url)[1]' 2>/dev/null | head -1 | cut -d '"' -f 2)"
appNewVersion="$(curl -fs https://craft-assets.invisionapp.com/CraftManager/production/appcast.xml | xpath '(//rss/channel/item/enclosure/@sparkle:shortVersionString)[1]' 2>/dev/null | head -1 | cut -d '"' -f 2)"
expectedTeamID="VRXQSNCL5W"
;;

View File

@@ -0,0 +1,7 @@
insomnia)
name="insomnia"
type="dmg"
downloadURL=$(downloadURLFromGit kong insomnia)
appNewVersion=$(versionFromGit kong insomnia)
expectedTeamID="FX44YY62GV"
;;

View File

@@ -0,0 +1,11 @@
jetbrainstoolbox)
name="JetBrains Toolbox"
type="dmg"
if [[ $(arch) == i386 ]]; then
downloadURL="https://download.jetbrains.com/product?code=TB&latest&distribution=mac"
elif [[ $(arch) == arm64 ]]; then
downloadURL="https://download.jetbrains.com/product?code=TB&latest&distribution=macM1"
fi
appNewVersion=$( curl -fsIL "${downloadURL}" | grep -i "location" | tail -1 | sed -E 's/.*\/[a-zA-Z-]*-([0-9.]*).*[-.].*dmg/\1/g' )
expectedTeamID="2ZEFAR8TH3"
;;

View File

@@ -0,0 +1,7 @@
muzzle)
name="Muzzle"
type="zip"
downloadURL="https://muzzleapp.com/binaries/muzzle.zip"
appNewVersion=$(curl -fs https://muzzleapp.com/updates/ | grep -io 'h2.*Version.* [0-9.]*.*h2' | head -1 | sed -E 's/.*ersion *([0-9.]*).*/\1/g')
expectedTeamID="49EYHPJ4Q3"
;;

View File

@@ -1,7 +1,7 @@
platypus)
name="Platypus"
type="zip"
downloadURL=$(downloadURLFromGit sveinbjornt Platypus)
appNewVersion=$(versionFromGit sveinbjornt Platypus)
expectedTeamID="55GP2M789L"
;;
name="Platypus"
type="zip"
downloadURL=$(downloadURLFromGit sveinbjornt Platypus)
appNewVersion=$(versionFromGit sveinbjornt Platypus)
expectedTeamID="55GP2M789L"
;;

View File

@@ -1,8 +1,8 @@
scaleft)
name="ScaleFT"
type="pkg"
downloadURL="https://dist.scaleft.com/client-tools/mac/latest/ScaleFT.pkg"
appNewVersion=$(curl -sf "https://dist.scaleft.com/client-tools/mac/" | awk '/dir/{i++}i==2' | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p')
expectedTeamID="HV2G9Z3RP5"
blockingProcesses=( ScaleFT )
;;
name="ScaleFT"
type="pkg"
downloadURL="https://dist.scaleft.com/client-tools/mac/latest/ScaleFT.pkg"
appNewVersion=$(curl -sf "https://dist.scaleft.com/client-tools/mac/" | awk '/dir/{i++}i==2' | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p')
expectedTeamID="HV2G9Z3RP5"
blockingProcesses=( ScaleFT )
;;

View File

@@ -2,11 +2,6 @@ slack)
name="Slack"
type="dmg"
downloadURL="https://slack.com/ssb/download-osx-universal" # Universal
# if [[ $(arch) == "arm64" ]]; then
# downloadURL="https://slack.com/ssb/download-osx-silicon"
# elif [[ $(arch) == "i386" ]]; then
# downloadURL="https://slack.com/ssb/download-osx"
# fi
appNewVersion=$( curl -fsIL "${downloadURL}" | grep -i "^location" | awk '{print $2}' | tr -d '\r\n' | sed -E 's/.*macos\/([0-9.]*)\/.*/\1/g' )
expectedTeamID="BQR82RBBHL"
;;

View File

@@ -0,0 +1,7 @@
smartgit)
name="SmartGit"
type="dmg"
downloadURL="https://www.syntevo.com$(curl -fs "https://www.syntevo.com/smartgit/download/" | grep -i -o -E "/downloads/.*/smartgit.*\.dmg")"
appNewVersion="$(curl -fs "https://www.syntevo.com/smartgit/changelog.txt" | grep -i -E "SmartGit *[0-9.]* *.*" | head -1 | awk '{print $2}')"
expectedTeamID="PHMY45PTNW"
;;

View File

@@ -1,7 +0,0 @@
webexteams)
# credit: Erik Stam (@erikstam)
name="Webex Teams"
type="dmg"
downloadURL="https://binaries.webex.com/WebexTeamsDesktop-MACOS-Gold/WebexTeams.dmg"
expectedTeamID="DE8Y96K9QP"
;;

View File

@@ -1,13 +1,13 @@
zulujdk8)
name="Zulu JDK 8"
type="pkgInDmg"
packageID="com.azulsystems.zulu.8"
if [[ $(arch) == i386 ]]; then
downloadURL=https://cdn.azul.com/zulu/bin/$(curl -fs "https://cdn.azul.com/zulu/bin/" | grep -Eio '">zulu8.*ca-jdk8.*x64.dmg(.*)' | cut -c3- | sed 's/<\/a>//' | sed -E 's/([0-9.]*)M//' | awk '{print $2 $1}' | sort | cut -c11- | tail -1)
elif [[ $(arch) == arm64 ]]; then
downloadURL=https://cdn.azul.com/zulu/bin/$(curl -fs "https://cdn.azul.com/zulu/bin/" | grep -Eio '">zulu8.*ca-jdk8.*aarch64.dmg(.*)' | cut -c3- | sed 's/<\/a>//' | sed -E 's/([0-9.]*)M//' | awk '{print $2 $1}' | sort | cut -c11- | tail -1)
fi
expectedTeamID="TDTHCUPYFR"
appCustomVersion(){ if [ -f "/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Info.plist" ]; then /usr/bin/defaults read "/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Info.plist" "CFBundleName" | sed 's/Zulu //'; fi }
appNewVersion=$(echo "$downloadURL" | cut -d "-" -f 1 | sed -e "s/.*zulu//") # Cannot be compared to anything
;;
name="Zulu JDK 8"
type="pkgInDmg"
packageID="com.azulsystems.zulu.8"
if [[ $(arch) == i386 ]]; then
downloadURL=https://cdn.azul.com/zulu/bin/$(curl -fs "https://cdn.azul.com/zulu/bin/" | grep -Eio '">zulu8.*ca-jdk8.*x64.dmg(.*)' | cut -c3- | sed 's/<\/a>//' | sed -E 's/([0-9.]*)M//' | awk '{print $2 $1}' | sort | cut -c11- | tail -1)
elif [[ $(arch) == arm64 ]]; then
downloadURL=https://cdn.azul.com/zulu/bin/$(curl -fs "https://cdn.azul.com/zulu/bin/" | grep -Eio '">zulu8.*ca-jdk8.*aarch64.dmg(.*)' | cut -c3- | sed 's/<\/a>//' | sed -E 's/([0-9.]*)M//' | awk '{print $2 $1}' | sort | cut -c11- | tail -1)
fi
expectedTeamID="TDTHCUPYFR"
appCustomVersion(){ if [ -f "/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Info.plist" ]; then /usr/bin/defaults read "/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Info.plist" "CFBundleName" | sed 's/Zulu //'; fi }
appNewVersion=$(echo "$downloadURL" | cut -d "-" -f 1 | sed -e "s/.*zulu//") # Cannot be compared to anything
;;

View File

@@ -12,7 +12,10 @@ downloadURL=${1?:"need to provide a download URL"}
# create temporary working directory
tmpDir=$(dirname $0 )
# tmpDir=$(mktemp -d ) # create a temporary folder, can be removed in the bottom of script
# tmpDir=$(dirname "$0") # (REMEMBER to comment out removal of tmpDir in bottom of script)
tmpDir=$(pwd) # use working directory as download folder (REMEMBER to comment out removal of tmpDir in bottom of script)
# change directory to temporary working directory
echo "Changing directory to $tmpDir"
@@ -122,6 +125,10 @@ elif [ "$archiveExt" = "zip" ] || [ "$archiveExt" = "tbz" ]; then
fi
echo
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
@@ -139,6 +146,9 @@ echo " appName=\"$appName\""
fi
echo " ;;"
echo
echo "Above should be saved in a file with exact same name as label, and given extension “.sh”."
echo "Put this file in folder “fragments/labels”."
echo
#if [ -e "${tmpDir}" ]; then
# #echo "deleting tmp dir"

224
utils/checkLabels.sh Executable file
View File

@@ -0,0 +1,224 @@
#!/bin/zsh
# Check Installomator labels from fragments
# 2020 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.
# If none are provided, it will test all labels.
# Labels should be named in small caps, numbers 0-9, “-”, and “_”. No other characters allowed.
# To check this script use these labels:
# desktoppr dbeaverce brave microsoftteams whatsapp citrixworkspace aircall devonthink
# MARK: Constants
pathToLabels="fragments/labels"
if [[ ! -d ${pathToLabels} ]]; then
echo "This script should be called from Installomator directory as working directory with this command:"
echo "utils/checkLabels.sh"
echo
exit 99
fi
# MARK: Check minimal macOS requirement
if [[ $(sw_vers -buildVersion ) < "18" ]]; then
echo "Installomator requires at least macOS 10.14 Mojave."
exit 98
fi
# MARK: Functions
printlog(){
echo "$1"
}
runAsUser() {
if [[ $currentUser != "loginwindow" ]]; then
uid=$(id -u "$currentUser")
launchctl asuser $uid sudo -u $currentUser "$@"
fi
}
# will get the latest release download from a github repo
downloadURLFromGit() { # $1 git user name, $2 git repo name
gitusername=${1?:"no git user name"}
gitreponame=${2?:"no git repo name"}
#githubPart="$gitusername/$gitreponame/releases/download"
#echo "$githubPart"
downloadURL="https://github.com/$gitusername/$gitreponame/releases/latest"
echo "$downloadURL"
return 0
}
versionFromGit() { # $1 git user name, $2 git repo name
gitusername=${1?:"no git user name"}
gitreponame=${2?:"no git repo name"}
appNewVersion=$(curl --silent --fail "https://github.com/$gitusername/$gitreponame/releases/latest" | sed -E 's/.*tag\/(.*)\">.*/\1/g' | sed 's/[^0-9\.]//g')
if [ -z "$appNewVersion" ]; then
printlog "could not retrieve version number for $gitusername/$gitreponame: $appNewVersion"
exit 9
else
echo "$appNewVersion"
return 0
fi
}
# Handling of differences in xpath between Catalina and Big Sur
xpath() {
# the xpath tool changes in Big Sur and now requires the `-e` option
if [[ $(sw_vers -buildVersion) > "20A" ]]; then
/usr/bin/xpath -e $@
else
/usr/bin/xpath $@
fi
}
# Handling architecture, so I can verify both i386 and arm64 architectures
arch () {
echo $fixedArch
}
# MARK: Script
RED='\033[0;31m'
GREEN='\033[0;32m'
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)" ${pathToLabels}/* | awk '{print $1}' | sed -E 's/.*\/([a-z0-9\_-]*)\..*/\1/g'| uniq ) )
echo "${BLUE}Labels with \"\$(arch)\" call:${NC}\n${archLabels}\n"
if [[ $# -eq 0 ]]; then
allLabels=( $(grep -h -E '^([a-z0-9\_-]*)(\)|\|\\)$' ${pathToLabels}/*.sh | tr -d ')|\\' | sort) )
else
allLabels=( ${=@} )
fi
echo "${BLUE}Total labels:${NC}\n${allLabels}\n"
secondRoundLabels="" # variable for labels with $(arch) call in them
countWarning=0
countError=0
for fixedArch in i386 arm64; do
echo "${BLUE}Architecture: $fixedArch${NC}"
echo
# Go through all labels
for label in $allLabels; do
echo "########## $label"
labelWarning=0; labelError=0; expectedExtension=""; URLextension=""
name=""; type=""; downloadURL=""; appNewVersion=""; expectedTeamID=""; blockingProcesses=""; updateTool=""; updateToolArguments=""; archiveName=""
#caseLabel
cat "${pathToLabels}/${label}.sh" | grep -v -E '^[a-z0-9\_-]*(\)|\|\\)$' | grep -v ";;" > checkLabelCurrent.sh
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
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
fi
if curl -sfL --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
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
fi
else
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 (($archLabels[(Ie)$label])); then
secondRoundLabels+=( "$label" )
fi
echo
done
allLabels=( ${=secondRoundLabels} )
archLabels=()
echo
done
rm checkLabelCurrent.sh
#${SELFLOCATION}/Installomator.sh version
#echo
if [[ countWarning > 0 ]]; then
echo "${YELLOW}Warnings counted: $countWarning${NC}"
else
echo "${GREEN}No warnings detected!${NC}"
fi
if [[ countError > 0 ]]; then
echo "${RED}ERRORS counted: $countError${NC}"
else
echo "${GREEN}No errors detected!${NC}"
fi
echo "Done!"

View File

@@ -1,5 +1,8 @@
#!/bin/zsh
# This script will create individual labels files from the original Installomator.sh script
# Only for internal use
label_re='^([a-z0-9\_-]*)(\)|\|\\)$'
endlabel_re='^( |\t);;$'
@@ -24,4 +27,4 @@ while read -r line; do
current_label=""
fi
done <./Installomator.sh
done <../Installomator.sh