mirror of
https://github.com/mtan93/Installomator.git
synced 2026-03-08 05:31:53 +00:00
Merge pull request #316 from Installomator/Update/install-detection
update/installation detection
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
## v0.8
|
||||
|
||||
- Installomator now detects when an app is already installed, and will display notifications correctly the user based on if the app was updated or installed for the first time.
|
||||
- New variables for labels that should be installaed using CLI: `CLIInstaller` and `CLIArguments`. If the installer app is named differently than the installed app, then the variable `installerTool` should be use to name the app that should be located in the DMG or zip. See the label __adobecreativeclouddesktop__ to see it’s use.
|
||||
- `buildLabel.sh` has been improved to build GitHub software labels much easier. In essense if the URL contains github.com, then it will try to find if it's the latest version or if variable `archiveName` is needed for finding the software. Also improved messaging throughout the script, as well as handling a situation where a pkg does not include a “DIstribution” file, but a “PackageInfo”.
|
||||
|
||||
|
||||
@@ -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."
|
||||
@@ -628,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
|
||||
}
|
||||
|
||||
|
||||
@@ -169,14 +169,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
|
||||
@@ -199,7 +207,11 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user