From f65010ecb4ad8e70f8fe775979bfe5b20fcf7feb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Wed, 8 Sep 2021 20:11:36 +0200 Subject: [PATCH] App from App Store In this branch I demand that INSTALL=force if an App Store app should be replaced. Best example is Slack that will loose all settings if it is replaced. But we can still do it and the log will show what we are doing. --- fragments/functions.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fragments/functions.sh b/fragments/functions.sh index 58da2df..5f7c866 100644 --- a/fragments/functions.sh +++ b/fragments/functions.sh @@ -173,6 +173,17 @@ 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" + # Is current app from App Store + if [[ -d "$installedAppPath"/Contents/_MASReceipt ]];then + printlog "Installed $appName is from App Store, use INSTALL=force to replace." + # INSTALL="force" + # Maybe we should exit instead + if [[ $INSTALL == "force" ]]; then + printlog "Force is used so continuing" + else + cleanupAndExit 1 "App previously installed from App Store" + fi + fi else printlog "could not determine location of $appName" fi