Skip to content

Commit

Permalink
fix user/group permission not set correctly in persist
Browse files Browse the repository at this point in the history
No idea how this ever worked, but for me all directories in /persistent
never have the write user/group permissions when freshly created.
This now also ensures that permissions will change if the configuration
changes, which is a nice side effect.
  • Loading branch information
Mic92 committed Oct 4, 2024
1 parent 2bd09dc commit 32b1094
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions create-directories.bash
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,10 @@ fi
realSource="$(realpath -m "$sourceBase$target")"
if [[ ! -d "$realSource" ]]; then
printf "Warning: Source directory '%s' does not exist; it will be created for you with the following permissions: owner: '%s:%s', mode: '%s'.\n" "$realSource" "$user" "$group" "$mode"
mkdir --mode="$mode" "$realSource"
chown "$user:$group" "$realSource"
mkdir "$realSource"
fi

[[ -d "$target" ]] || mkdir "$target"

# synchronize perms between source and target
chown --reference="$realSource" "$target"
chmod --reference="$realSource" "$target"
chown "$user:$group" "$realSource" "$target"
chmod "$mode" "$realSource" "$target"

0 comments on commit 32b1094

Please sign in to comment.