summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--custom/recv-media.sh12
-rw-r--r--custom/uucp-mediaclient.nix15
2 files changed, 21 insertions, 6 deletions
diff --git a/custom/recv-media.sh b/custom/recv-media.sh
index f99aaaf0..d9ed888d 100644
--- a/custom/recv-media.sh
+++ b/custom/recv-media.sh
@@ -16,12 +16,12 @@ if [[ -n "${3}" ]]; then
16 target="${dir}"/$(@coreutils@/bin/base64 -d <<<${3}) 16 target="${dir}"/$(@coreutils@/bin/base64 -d <<<${3})
17fi 17fi
18 18
19@utillinux@/bin/logger --id=$pid -t recv-media -p user.debug <<EOF 19# @utillinux@/bin/logger --id=$pid -t recv-media -p user.debug <<EOF
20$(id) 20# $(id)
21$(stat ${dir}) 21# $(stat ${dir})
22$(stat ${1}) 22# $(stat ${1})
23$(echo ${2}) 23# $(echo ${2})
24EOF 24# EOF
25 25
26if [[ $(id -Gn) != *"$group"* ]]; then 26if [[ $(id -Gn) != *"$group"* ]]; then
27 printf "Groups are ‘%s’. Trying to switch primary group to ‘%s’..." $(id -Gn) $group 27 printf "Groups are ‘%s’. Trying to switch primary group to ‘%s’..." $(id -Gn) $group
diff --git a/custom/uucp-mediaclient.nix b/custom/uucp-mediaclient.nix
index 42fa0246..1b79d4a5 100644
--- a/custom/uucp-mediaclient.nix
+++ b/custom/uucp-mediaclient.nix
@@ -76,6 +76,11 @@ in {
76 default = "/var/media"; 76 default = "/var/media";
77 description = "Media directory"; 77 description = "Media directory";
78 }; 78 };
79
80 mediaGroup = mkOption {
81 type = types.str;
82 default = "media";
83 };
79 }; 84 };
80 }; 85 };
81 86
@@ -86,6 +91,16 @@ in {
86 services.uucp.remoteNodes = genAttrs cfg.remoteNodes (name: { commands = ["recv-media"]; } ); 91 services.uucp.remoteNodes = genAttrs cfg.remoteNodes (name: { commands = ["recv-media"]; } );
87 92
88 assertions = map (user: { assertion = elem user config.services.notify-users; message = "Notification must be allowed for ${user}!"; }) (unique cfg.notify.users); 93 assertions = map (user: { assertion = elem user config.services.notify-users; message = "Notification must be allowed for ${user}!"; }) (unique cfg.notify.users);
94
95 users.groups."${cfg.mediaGroup}" = {
96 members = [ "uucp" ];
97 };
98
99 system.activationScripts = ''
100 mkdir -m 0755 -pv ${cfg.mediaDir}
101 chown :${cfg.mediaGroup} ${cfg.mediaDir}
102 chmod -c "g+rwx" ${cfg.mediaDir}
103 '';
89 }; 104 };
90} 105}
91 106