mirror of
https://github.com/mtan93/Installomator.git
synced 2026-04-01 14:23:06 +01:00
Merge branch 'dev' into microsoft-labels-updates
This commit is contained in:
@@ -36,6 +36,12 @@ done
|
||||
# lowercase the label
|
||||
label=${label:l}
|
||||
|
||||
# separate check for 'version' in order to print plain version number without any other information
|
||||
if [ $label == "version" ]; then
|
||||
echo "$VERSION"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
printlog "################## Start Installomator v. $VERSION"
|
||||
printlog "################## $label"
|
||||
|
||||
@@ -49,11 +55,6 @@ currentUser=$(scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ { print
|
||||
|
||||
# MARK: labels in case statement
|
||||
case $label in
|
||||
version)
|
||||
# print the script VERSION
|
||||
printlog "$VERSION"
|
||||
exit 0
|
||||
;;
|
||||
longversion)
|
||||
# print the script version
|
||||
printlog "Installomater: version $VERSION ($VERSIONDATE)"
|
||||
|
||||
@@ -148,6 +148,7 @@ getAppVersion() {
|
||||
appversion="$(pkgutil --pkg-info-plist ${packageID} 2>/dev/null | grep -A 1 pkg-version | tail -1 | sed -E 's/.*>([0-9.]*)<.*/\1/g')"
|
||||
if [[ $appversion != "" ]]; then
|
||||
printlog "found packageID $packageID installed, version $appversion"
|
||||
updateDetected="YES"
|
||||
return
|
||||
else
|
||||
printlog "No version found using packageID $packageID"
|
||||
@@ -162,7 +163,11 @@ getAppVersion() {
|
||||
else
|
||||
applist=$(mdfind "kind:application $appName" -0 )
|
||||
fi
|
||||
printlog "App(s) found: ${applist}"
|
||||
if [[ -z applist ]]; then
|
||||
printlog "No previous app found"
|
||||
else
|
||||
printlog "App(s) found: ${applist}"
|
||||
fi
|
||||
|
||||
appPathArray=( ${(0)applist} )
|
||||
|
||||
@@ -173,6 +178,7 @@ getAppVersion() {
|
||||
#appversion=$(mdls -name kMDItemVersion -raw $installedAppPath )
|
||||
appversion=$(defaults read $installedAppPath/Contents/Info.plist $versionKey) #Not dependant on Spotlight indexing
|
||||
printlog "found app at $installedAppPath, version $appversion"
|
||||
updateDetected="YES"
|
||||
# Is current app from App Store
|
||||
if [[ -d "$installedAppPath"/Contents/_MASReceipt ]];then
|
||||
printlog "Installed $appName is from App Store, use “IGNORE_APP_STORE_APPS=yes” to replace."
|
||||
@@ -342,7 +348,7 @@ installAppWithPath() { # $1: path to app to install in $targetDir
|
||||
# versioncheck
|
||||
# credit: Søren Theilgaard (@theilgaard)
|
||||
appNewVersion=$(defaults read $appPath/Contents/Info.plist $versionKey)
|
||||
if [[ $appversion == $appNewVersion ]]; then
|
||||
if [[ -n $appNewVersion && $appversion == $appNewVersion ]]; then
|
||||
printlog "Downloaded version of $name is $appNewVersion, same as installed."
|
||||
if [[ $INSTALL != "force" ]]; then
|
||||
message="$name, version $appNewVersion, is the latest version."
|
||||
@@ -369,7 +375,9 @@ installAppWithPath() { # $1: path to app to install in $targetDir
|
||||
# not running as root
|
||||
cleanupAndExit 6 "not running as root, exiting"
|
||||
fi
|
||||
|
||||
|
||||
# Test if variable CLIInstaller is set
|
||||
if [[ -z $CLIInstaller ]]; then
|
||||
# remove existing application
|
||||
if [ -e "$targetDir/$appName" ]; then
|
||||
printlog "Removing existing $targetDir/$appName"
|
||||
@@ -382,7 +390,6 @@ installAppWithPath() { # $1: path to app to install in $targetDir
|
||||
cleanupAndExit 7 "Error while copying"
|
||||
fi
|
||||
|
||||
|
||||
# set ownership to current user
|
||||
if [ "$currentUser" != "loginwindow" ]; then
|
||||
printlog "Changing owner to $currentUser"
|
||||
@@ -391,6 +398,22 @@ installAppWithPath() { # $1: path to app to install in $targetDir
|
||||
printlog "No user logged in, not changing user"
|
||||
fi
|
||||
|
||||
elif [[ ! -z $CLIInstaller ]]; then
|
||||
mountname=$(dirname $appPath)
|
||||
printlog "CLIInstaller exists, running installer command $mountname/$CLIInstaller $CLIArguments" #INFO
|
||||
|
||||
CLIoutput=$("$mountname/$CLIInstaller" "${CLIArguments[@]}" 2>&1)
|
||||
CLIstatus=$(echo $?)
|
||||
logoutput="$CLIoutput" # dedupliatelogs "$CLIoutput"
|
||||
|
||||
if [ $CLIstatus -ne 0 ] ; then
|
||||
cleanupAndExit 3 "Error installing $mountname/$CLIInstaller $CLIArguments error:\n$logoutput" #ERROR
|
||||
else
|
||||
printlog "Succesfully ran $mountname/$CLIInstaller $CLIArguments"
|
||||
fi
|
||||
printlog "Debugging enabled, update tool output was:\n$logoutput" #DEBUG
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
mountDMG() {
|
||||
@@ -411,7 +434,6 @@ mountDMG() {
|
||||
|
||||
installFromDMG() {
|
||||
mountDMG
|
||||
|
||||
installAppWithPath "$dmgmount/$appName"
|
||||
}
|
||||
|
||||
@@ -612,7 +634,11 @@ finishing() {
|
||||
|
||||
if [[ $currentUser != "loginwindow" && ( $NOTIFY == "success" || $NOTIFY == "all" ) ]]; then
|
||||
printlog "notifying"
|
||||
displaynotification "$message" "$name update/installation complete!"
|
||||
if [[ $updateDetected == "YES" ]]; then
|
||||
displaynotification "$message" "$name update complete!"
|
||||
else
|
||||
displaynotification "$message" "$name installation complete!"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -198,8 +198,27 @@ REOPEN="yes"
|
||||
# $updateTool $updateArguments
|
||||
# Will be run instead of of downloading and installing a complete new version.
|
||||
# Use this when the updateTool does differential and optimized downloads.
|
||||
# e.g. msupdate
|
||||
# e.g. msupdate on various Microsoft labels
|
||||
#
|
||||
# - updateToolRunAsCurrentUser:
|
||||
# When this variable is set (any value), $updateTool will be run as the current user.
|
||||
#
|
||||
# - CLIInstaller:
|
||||
# - CLIArguments:
|
||||
# If the downloaded dmg is actually an installer that we can call using CLI, we can
|
||||
# use these two variables for what to call.
|
||||
# We need to define `name` for the installed app (to be version checked), as well as
|
||||
# `installerTool` for the installer app (if named differently that `name`. Installomator
|
||||
# will add the path to the folder/disk image with the binary, and it will be called like this:
|
||||
`$CLIInstaller $CLIArguments`
|
||||
# For most installations `CLIInstaller` should contain the `installerTool` for the CLI call
|
||||
# (if it’s the same).
|
||||
# We can support a whole range of other software titles by implementing this.
|
||||
# See label adobecreativeclouddesktop
|
||||
#
|
||||
# - installerTool:
|
||||
# Introduced as part of `CLIInstaller`. If the installer in the DMG or ZIP is named
|
||||
# differently than the installed app, then this variable can be used to name the
|
||||
# installer that should be located after mounting/expanding the downloaded archive.
|
||||
# See label adobecreativeclouddesktop
|
||||
#
|
||||
|
||||
17
fragments/labels/adobecreativeclouddesktop.sh
Normal file
17
fragments/labels/adobecreativeclouddesktop.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
adobecreativeclouddesktop)
|
||||
name="Adobe Creative Cloud"
|
||||
#appName="Install.app"
|
||||
type="dmg"
|
||||
if [[ $(arch) == "arm64" ]]; then
|
||||
downloadURL=$(curl -fs "https://helpx.adobe.com/download-install/kb/creative-cloud-desktop-app-download.html" | grep -o "https*.*macarm64.*dmg" | cut -d '"' -f1 | head -1)
|
||||
elif [[ $(arch) == "i386" ]]; then
|
||||
downloadURL=$(curl -fs "https://helpx.adobe.com/download-install/kb/creative-cloud-desktop-app-download.html" | grep -o "https*.*osx10.*dmg" | cut -d '"' -f1 | head -1)
|
||||
fi
|
||||
#downloadURL=$(curl -fs "https://helpx.adobe.com/download-install/kb/creative-cloud-desktop-app-download.html" | grep -o "https*.*dmg" | head -1)
|
||||
appNewVersion=$(curl -fs "https://helpx.adobe.com/creative-cloud/release-note/cc-release-notes.html" | grep "mandatory" | head -1 | grep -o "Version *.* released" | cut -d " " -f2)
|
||||
installerTool="Install.app"
|
||||
CLIInstaller="Install.app/Contents/MacOS/Install"
|
||||
CLIArguments=(--mode=silent)
|
||||
expectedTeamID="JQ525L2MZD"
|
||||
Company="Adobe"
|
||||
;;
|
||||
9
fragments/labels/eshareosx.sh
Normal file
9
fragments/labels/eshareosx.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
eshareosx)
|
||||
name="e-Share"
|
||||
type="pkg"
|
||||
packageID="com.ncryptedcloud.e-Share.pkg"
|
||||
downloadURL=https://www.ncryptedcloud.com/static/downloads/osx/$(curl -fs https://www.ncryptedcloud.com/static/downloads/osx/ | grep -o -i "href.*\".*\"" | cut -d '"' -f2)
|
||||
versionKey="CFBundleVersion"
|
||||
appNewVersion=$( echo "${downloadURL}" | sed -E 's/.*\/[a-zA-Z\-]*_([0-9.]*)\.pkg/\1/g' )
|
||||
expectedTeamID="X9MBQS7DDC"
|
||||
;;
|
||||
7
fragments/labels/maccyapp.sh
Normal file
7
fragments/labels/maccyapp.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
maccyapp)
|
||||
name="Maccy"
|
||||
type="zip"
|
||||
downloadURL="$(downloadURLFromGit p0deje Maccy)"
|
||||
appNewVersion="$(versionFromGit p0deje Maccy)"
|
||||
expectedTeamID="MN3X4648SC"
|
||||
;;
|
||||
8
fragments/labels/nudge.sh
Normal file
8
fragments/labels/nudge.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
nudge)
|
||||
name="Nudge"
|
||||
type="pkg"
|
||||
downloadURL=$(downloadURLFromGit macadmins Nudge )
|
||||
appNewVersion=$(versionFromGit macadmins Nudge )
|
||||
expectedTeamID="9GQZ7KUFR6"
|
||||
archiveName="Nudge-[0-9.]*.pkg"
|
||||
;;
|
||||
8
fragments/labels/overflow.sh
Normal file
8
fragments/labels/overflow.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
overflow)
|
||||
name="Overflow"
|
||||
type="dmg"
|
||||
downloadURL="$(curl -sL 'https://overflow.io/download/' | awk -F '"' '/app-updates.overflow.io\/packages\/updates\/osx_64/ { print $8; exit }')"
|
||||
appNewVersion=$(echo "$downloadURL" | awk -F '-|[.]dmg' '{ print $(NF-1) }')
|
||||
expectedTeamID="7TK7YSGJFF"
|
||||
versionKey="CFBundleShortVersionString"
|
||||
;;
|
||||
6
fragments/labels/sketchupviewer.sh
Normal file
6
fragments/labels/sketchupviewer.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
sketchupviewer)
|
||||
name="SketchUpViewer"
|
||||
type="dmg"
|
||||
downloadURL="$(curl -fs https://www.sketchup.com/sketchup/SketchUpViewer-en-dmg | grep "<a href=" | sed 's/.*href="//' | sed 's/".*//')"
|
||||
expectedTeamID="J8PVMCY7KL"
|
||||
;;
|
||||
7
fragments/labels/talkdeskcallbar.sh
Normal file
7
fragments/labels/talkdeskcallbar.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
talkdeskcallbar)
|
||||
name="Callbar"
|
||||
type="dmg"
|
||||
downloadURL=https://downloadcallbar.talkdesk.com/Callbar-$(curl -fsL https://downloadcallbar.talkdesk.com/release_metadata.json | sed -n 's/^.*"version":"\([^"]*\)".*$/\1/p').dmg
|
||||
appNewVersion=$(curl -fsL https://downloadcallbar.talkdesk.com/release_metadata.json | sed -n 's/^.*"version":"\([^"]*\)".*$/\1/p')
|
||||
expectedTeamID="YGGJX44TB8"
|
||||
;;
|
||||
@@ -1,7 +1,9 @@
|
||||
typora)
|
||||
name="Typora"
|
||||
type="dmg"
|
||||
downloadURL="https://www.typora.io/download/Typora.dmg"
|
||||
appNewVersion="$(curl -fs "https://www.typora.io/dev_release.html" | grep -o -i "h4>[0-9.]*</h4" | head -1 | sed -E 's/.*h4>([0-9.]*)<\/h4.*/\1/')"
|
||||
#downloadURL="https://www.typora.io/download/Typora.dmg"
|
||||
downloadURL=$(curl -fs "https://www.typora.io/download/dev_update.xml" | xpath '(//rss/channel/item/enclosure/@url)[1]' 2>/dev/null | cut -d '"' -f2)
|
||||
#appNewVersion="$(curl -fs "https://www.typora.io/dev_release.html" | grep -o -i "h4>[0-9.]*</h4" | head -1 | sed -E 's/.*h4>([0-9.]*)<\/h4.*/\1/')"
|
||||
appNewVersion=$(curl -fs "https://www.typora.io/download/dev_update.xml" | xpath '(//rss/channel/item/enclosure/@sparkle:shortVersionString)[1]' 2>/dev/null | cut -d '"' -f2)
|
||||
expectedTeamID="9HWK5273G4"
|
||||
;;
|
||||
|
||||
@@ -166,14 +166,22 @@ else
|
||||
printlog "Downloading $downloadURL to $archiveName"
|
||||
if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then
|
||||
printlog "notifying"
|
||||
displaynotification "Downloading $name update" "Download in progress …"
|
||||
if [[ $updateDetected == "YES" ]]; then
|
||||
displaynotification "Downloading $name update" "Download in progress …"
|
||||
else
|
||||
displaynotification "Downloading new $name" "Download in progress …"
|
||||
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"
|
||||
displaynotification "$message" "Error installing/updating $name"
|
||||
if [[ $updateDetected == "YES" ]]; then
|
||||
displaynotification "$message" "Error updating $name"
|
||||
else
|
||||
displaynotification "$message" "Error installing $name"
|
||||
fi
|
||||
fi
|
||||
cleanupAndExit 2
|
||||
fi
|
||||
@@ -196,7 +204,17 @@ fi
|
||||
printlog "Installing $name"
|
||||
if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then
|
||||
printlog "notifying"
|
||||
displaynotification "Installing $name" "Installation in progress …"
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user