Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add argument for ignoring user files #25

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions fragments/header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ swiftDialog="/usr/local/bin/dialog"
appVersionKey="CFBundleShortVersionString"
appBundleIdentifierKey="CFBundleIdentifier"

# ignore deletion of files in user directories
IGNORE_USER_DIRS=0
# options:
# 0 delete files/directories in user directories
# 1 ignore deletion of files in user directories, with exception of LaunchAgents
16 changes: 10 additions & 6 deletions fragments/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,16 @@ fi
for file in "${appFiles[@]}"
do
if [[ "$file" == *"<<Users>>"* ]]; then
# remove path with expanded path for all available userfolders
for userfolder in $(ls /Users)
do
expandedPath=$(echo $file | sed "s|<<Users>>|/Users/$userfolder|g")
removeFileDirectory "$expandedPath" silent
done
if [[ $IGNORE_USER_DIRS == 0 ]]; then
# remove path with expanded path for all available userfolders
for userfolder in $(ls /Users)
do
expandedPath=$(echo $file | sed "s|<<Users>>|/Users/$userfolder|g")
removeFileDirectory "$expandedPath" silent
done
else
printlog "Ignoring deletion of user files: $file"
fi
else
# remove real path
removeFileDirectory "$file"
Expand Down