diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2018-06-02 20:32:09 +0200 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2018-06-02 20:32:09 +0200 |
| commit | 937905d28c904205b1647095fa50827db91c249d (patch) | |
| tree | 9c7cef2c354402422107ea7ac668877652245040 /custom | |
| parent | f9f0bff4ca32f8c8f879ab7229ebe82dc345bc54 (diff) | |
| download | nixos-937905d28c904205b1647095fa50827db91c249d.tar nixos-937905d28c904205b1647095fa50827db91c249d.tar.gz nixos-937905d28c904205b1647095fa50827db91c249d.tar.bz2 nixos-937905d28c904205b1647095fa50827db91c249d.tar.xz nixos-937905d28c904205b1647095fa50827db91c249d.zip | |
disable debug & add media group
Diffstat (limited to 'custom')
| -rw-r--r-- | custom/recv-media.sh | 12 | ||||
| -rw-r--r-- | custom/uucp-mediaclient.nix | 15 |
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}) |
| 17 | fi | 17 | fi |
| 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}) |
| 24 | EOF | 24 | # EOF |
| 25 | 25 | ||
| 26 | if [[ $(id -Gn) != *"$group"* ]]; then | 26 | if [[ $(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 | ||
