finalize ensure perms
This commit is contained in:
@@ -22,28 +22,30 @@ in {
|
||||
# and to clean up the ownership from the arr stack in /holocron/media
|
||||
systemd.services.${service} = {
|
||||
description = "ensure file permissions for archives, media and user folders";
|
||||
wantedBy = ["multi-user.target"];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = ''
|
||||
#!/bin/bash
|
||||
ExecStart = pkgs.writeShellScript "ensure_perms" ''
|
||||
|
||||
# Fix ownership for archives directory
|
||||
chown -R root:archives ${archives_path}
|
||||
chmod -R 2770 ${archives_path}
|
||||
echo "starting ${archives_path}"
|
||||
chown -Rc root:archives ${archives_path}
|
||||
chmod -Rc 2770 ${archives_path}
|
||||
|
||||
# Fix ownership for media directory
|
||||
chown -R root:media ${media_path}
|
||||
chmod -R 2770 ${media_path}
|
||||
echo "starting ${media_path}"
|
||||
chown -Rc root:media ${media_path}
|
||||
chmod -Rc 2770 ${media_path}
|
||||
|
||||
# Fix user directories
|
||||
for user_dir in ${users_path}/*; do
|
||||
if [ -d "$user_dir" ]; then
|
||||
user=$(basename "$user_dir")
|
||||
chown -R "$user:$user" "$user_dir"
|
||||
chmod -R 700 "$user_dir"
|
||||
echo "starting $user_dir"
|
||||
chown -Rc "$user:$user" "$user_dir"
|
||||
chmod -Rc 700 "$user_dir"
|
||||
fi
|
||||
done
|
||||
echo "fin"
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user