mirror of
https://github.com/mtan93/Installomator.git
synced 2026-04-04 14:23:06 +01:00
v0.4.23 version checking of pkg
If type=pkg and packageID is set, then we can now check for version with that information.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
label="" # if no label is sent to the script, this will be used
|
||||||
|
|
||||||
# Installomator
|
# Installomator
|
||||||
#
|
#
|
||||||
@@ -8,7 +9,7 @@
|
|||||||
# inspired by the download scripts from William Smith and Sander Schram
|
# inspired by the download scripts from William Smith and Sander Schram
|
||||||
# with additional ideas and contribution from Isaac Ordonez, Mann consulting
|
# with additional ideas and contribution from Isaac Ordonez, Mann consulting
|
||||||
|
|
||||||
VERSION='0.4.22'
|
VERSION='0.4.23'
|
||||||
VERSIONDATE='2021-??-??'
|
VERSIONDATE='2021-??-??'
|
||||||
|
|
||||||
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
||||||
@@ -20,7 +21,6 @@ export PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
|||||||
# also no actual installation will be performed
|
# also no actual installation will be performed
|
||||||
DEBUG=1
|
DEBUG=1
|
||||||
|
|
||||||
|
|
||||||
# notify behavior
|
# notify behavior
|
||||||
NOTIFY=success
|
NOTIFY=success
|
||||||
# options:
|
# options:
|
||||||
@@ -176,7 +176,7 @@ cleanupAndExit() { # $1 = exit code, $2 message
|
|||||||
hdiutil detach "$dmgmount"
|
hdiutil detach "$dmgmount"
|
||||||
fi
|
fi
|
||||||
# If we closed any processes, reopen the app again
|
# If we closed any processes, reopen the app again
|
||||||
#reopenClosedProcess
|
reopenClosedProcess
|
||||||
printlog "################## End Installomator, exit code $1 \n\n"
|
printlog "################## End Installomator, exit code $1 \n\n"
|
||||||
exit "$1"
|
exit "$1"
|
||||||
}
|
}
|
||||||
@@ -548,6 +548,28 @@ installFromPKG() {
|
|||||||
cleanupAndExit 5
|
cleanupAndExit 5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check version of pkg to be installed if packageID is set
|
||||||
|
if [[ $packageID != "" && $appversion != "" ]]; then
|
||||||
|
printlog "Checking package version."
|
||||||
|
pkgutil --expand "$archiveName" "$archiveName"_pkg
|
||||||
|
appNewVersion=$(cat "$archiveName"_pkg/Distribution | xpath '//installer-gui-script/pkg-ref[@id][@version]' 2>/dev/null | grep "$packageID" | tr ' ' '\n' | grep version | sed -E 's/.*\"([0-9.]*)\".*/\1/g')
|
||||||
|
rm -r "$archiveName"_pkg
|
||||||
|
printlog "Downloaded package $packageID version $appNewVersion"
|
||||||
|
if [[ $appversion == $appNewVersion ]]; then
|
||||||
|
printlog "Downloaded version of $name is the same as installed."
|
||||||
|
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 new version to install"
|
||||||
|
else
|
||||||
|
printlog "Using force to install anyway."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# skip install for DEBUG
|
# skip install for DEBUG
|
||||||
if [ "$DEBUG" -ne 0 ]; then
|
if [ "$DEBUG" -ne 0 ]; then
|
||||||
printlog "DEBUG enabled, skipping installation"
|
printlog "DEBUG enabled, skipping installation"
|
||||||
@@ -693,10 +715,12 @@ fi
|
|||||||
|
|
||||||
# MARK: argument parsing
|
# MARK: argument parsing
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 0 ]]; then
|
||||||
printlog "no label provided, printing labels"
|
if [[ -z $label ]]; then # check if label is set inside script
|
||||||
grep -E '^[a-z0-9\_-]*(\)|\|\\)$' "$0" | tr -d ')|\' | grep -v -E '^(broken.*|longversion|version|valuesfromarguments)$' | sort
|
printlog "no label provided, printing labels"
|
||||||
#grep -E '^[a-z0-9\_-]*(\)|\|\\)$' "${labelFile}" | tr -d ')|\' | grep -v -E '^(broken.*|longversion|version|valuesfromarguments)$' | sort
|
grep -E '^[a-z0-9\_-]*(\)|\|\\)$' "$0" | tr -d ')|\' | grep -v -E '^(broken.*|longversion|version|valuesfromarguments)$' | sort
|
||||||
exit 0
|
#grep -E '^[a-z0-9\_-]*(\)|\|\\)$' "${labelFile}" | tr -d ')|\' | grep -v -E '^(broken.*|longversion|version|valuesfromarguments)$' | sort
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
elif [[ $1 == "/" ]]; then
|
elif [[ $1 == "/" ]]; then
|
||||||
# jamf uses sends '/' as the first argument
|
# jamf uses sends '/' as the first argument
|
||||||
printlog "shifting arguments for Jamf"
|
printlog "shifting arguments for Jamf"
|
||||||
@@ -1382,6 +1406,20 @@ hazel)
|
|||||||
appNewVersion=$(curl -fsI https://www.noodlesoft.com/Products/Hazel/download | grep -i "^location" | awk '{print $2}' | sed -E 's/.*\/[a-zA-Z]*-([0-9.]*)\..*/\1/g')
|
appNewVersion=$(curl -fsI https://www.noodlesoft.com/Products/Hazel/download | grep -i "^location" | awk '{print $2}' | sed -E 's/.*\/[a-zA-Z]*-([0-9.]*)\..*/\1/g')
|
||||||
expectedTeamID="86Z3GCJ4MF"
|
expectedTeamID="86Z3GCJ4MF"
|
||||||
;;
|
;;
|
||||||
|
hpeasyadmin)
|
||||||
|
# credit: Søren Theilgaard (@theilgaard)
|
||||||
|
name="HP Easy Admin"
|
||||||
|
type="zip"
|
||||||
|
downloadURL="https://ftp.hp.com/pub/softlib/software12/HP_Quick_Start/osx/Applications/HP_Easy_Admin.app.zip"
|
||||||
|
expectedTeamID="6HB5Y2QTA3"
|
||||||
|
;;
|
||||||
|
hpeasystart)
|
||||||
|
# credit: Søren Theilgaard (@theilgaard)
|
||||||
|
name="HP Easy Start"
|
||||||
|
type="zip"
|
||||||
|
downloadURL="https://ftp.hp.com/pub/softlib/software12/HP_Quick_Start/osx/Applications/HP_Easy_Start.app.zip"
|
||||||
|
expectedTeamID="6HB5Y2QTA3"
|
||||||
|
;;
|
||||||
hyper)
|
hyper)
|
||||||
# credit: Adrian Bühler (@midni9ht)
|
# credit: Adrian Bühler (@midni9ht)
|
||||||
name="Hyper"
|
name="Hyper"
|
||||||
@@ -1666,6 +1704,15 @@ obsidian)
|
|||||||
appNewVersion=$(versionFromGit obsidianmd obsidian-releases)
|
appNewVersion=$(versionFromGit obsidianmd obsidian-releases)
|
||||||
expectedTeamID="6JSW4SJWN9"
|
expectedTeamID="6JSW4SJWN9"
|
||||||
;;
|
;;
|
||||||
|
odrive)
|
||||||
|
# credit: Søren Theilgaard (@theilgaard)
|
||||||
|
name="odrive"
|
||||||
|
type="pkg"
|
||||||
|
packageID="com.oxygen.odrive.installer-prod.pkg"
|
||||||
|
# https://docs.odrive.com/docs/odrive-usage-guide#install-desktop-sync
|
||||||
|
downloadURL="https://www.odrive.com/downloaddesktop?platform=mac"
|
||||||
|
expectedTeamID="N887K88VYZ"
|
||||||
|
;;
|
||||||
omnidisksweeper)
|
omnidisksweeper)
|
||||||
name="OmniDiskSweeper"
|
name="OmniDiskSweeper"
|
||||||
type="dmg"
|
type="dmg"
|
||||||
@@ -1758,6 +1805,13 @@ pacifist)
|
|||||||
downloadURL="https://charlessoft.com/cgi-bin/pacifist_download.cgi?type=dmg"
|
downloadURL="https://charlessoft.com/cgi-bin/pacifist_download.cgi?type=dmg"
|
||||||
expectedTeamID="HRLUCP7QP4"
|
expectedTeamID="HRLUCP7QP4"
|
||||||
;;
|
;;
|
||||||
|
pdfsam)
|
||||||
|
name="PDFsam Basic"
|
||||||
|
type="dmg"
|
||||||
|
downloadURL=$(downloadURLFromGit torakiki pdfsam)
|
||||||
|
appNewVersion=$(versionFromGit torakiki pdfsam)
|
||||||
|
expectedTeamID="8XM3GHX436"
|
||||||
|
;;
|
||||||
pitch)
|
pitch)
|
||||||
name="Pitch"
|
name="Pitch"
|
||||||
type="dmg"
|
type="dmg"
|
||||||
|
|||||||
Reference in New Issue
Block a user