From d6a9d6707ee4a04cf883c1313f43a8a143b913ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Mon, 22 Nov 2021 16:21:24 +0100 Subject: [PATCH] Update functions.sh --- fragments/functions.sh | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/fragments/functions.sh b/fragments/functions.sh index 48d0ebc..fe21d0d 100644 --- a/fragments/functions.sh +++ b/fragments/functions.sh @@ -378,25 +378,26 @@ installAppWithPath() { # $1: path to app to install in $targetDir # Test if variable CLIInstaller is set if [[ -z $CLIInstaller ]]; then - # remove existing application - if [ -e "$targetDir/$appName" ]; then - printlog "Removing existing $targetDir/$appName" - rm -Rf "$targetDir/$appName" - fi + + # remove existing application + if [ -e "$targetDir/$appName" ]; then + printlog "Removing existing $targetDir/$appName" + rm -Rf "$targetDir/$appName" + fi - # copy app to /Applications - printlog "Copy $appPath to $targetDir" - if ! ditto "$appPath" "$targetDir/$appName"; then - cleanupAndExit 7 "Error while copying" - fi + # copy app to /Applications + printlog "Copy $appPath to $targetDir" + if ! ditto "$appPath" "$targetDir/$appName"; then + cleanupAndExit 7 "Error while copying" + fi - # set ownership to current user - if [ "$currentUser" != "loginwindow" ]; then - printlog "Changing owner to $currentUser" - chown -R "$currentUser" "$targetDir/$appName" - else - printlog "No user logged in, not changing user" - fi + # set ownership to current user + if [ "$currentUser" != "loginwindow" ]; then + printlog "Changing owner to $currentUser" + chown -R "$currentUser" "$targetDir/$appName" + else + printlog "No user logged in, not changing user" + fi elif [[ ! -z $CLIInstaller ]]; then mountname=$(dirname $appPath)