finalize ensure perms

This commit is contained in:
2025-10-16 21:12:25 -05:00
parent 0f2750b644
commit 1083c6c3e4

View File

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