Merge branch 'versionKey-improvements' into 2022-02-02_Theile-base

This commit is contained in:
Søren Theilgaard
2022-02-02 14:34:01 +01:00
2 changed files with 6 additions and 5 deletions

View File

@@ -52,8 +52,9 @@ if [[ $DEBUG -gt 0 ]]; then
fi
# How we get version number from app
# (alternative is "CFBundleVersion", that can be used in labels)
versionKey="CFBundleShortVersionString"
if [[ -z $versionKey ]]; then
versionKey="CFBundleShortVersionString"
fi
# get current user
currentUser=$(scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ { print $3 }')

View File

@@ -182,7 +182,7 @@ getAppVersion() {
installedAppPath=$filteredAppPaths[1]
#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"
printlog "found app at $installedAppPath, version $appversion, on versionKey $versionKey"
updateDetected="YES"
# Is current app from App Store
if [[ -d "$installedAppPath"/Contents/_MASReceipt ]];then
@@ -353,7 +353,7 @@ installAppWithPath() { # $1: path to app to install in $targetDir
# app versioncheck
appNewVersion=$(defaults read $appPath/Contents/Info.plist $versionKey)
if [[ -n $appNewVersion && $appversion == $appNewVersion ]]; then
printlog "Downloaded version of $name is $appNewVersion, same as installed."
printlog "Downloaded version of $name is $appNewVersion on versionKey $versionKey, same as installed."
if [[ $INSTALL != "force" ]]; then
message="$name, version $appNewVersion, is the latest version."
if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then
@@ -365,7 +365,7 @@ installAppWithPath() { # $1: path to app to install in $targetDir
printlog "Using force to install anyway."
fi
else
printlog "Downloaded version of $name is $appNewVersion (replacing version $appversion)."
printlog "Downloaded version of $name is $appNewVersion on versionKey $versionKey (replacing version $appversion)."
fi
# macOS versioncheck