summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2017-05-30 13:33:21 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2017-05-30 13:33:21 +0200
commite129d87f91052f8772bb6171164cf631083ce3d4 (patch)
tree876c26c5e33fd980eef57705e52361d80b34d154
parent03e69b6e82c5cf0bbd00ca3f73ca072d0aedbee4 (diff)
downloadnixos-e129d87f91052f8772bb6171164cf631083ce3d4.tar
nixos-e129d87f91052f8772bb6171164cf631083ce3d4.tar.gz
nixos-e129d87f91052f8772bb6171164cf631083ce3d4.tar.bz2
nixos-e129d87f91052f8772bb6171164cf631083ce3d4.tar.xz
nixos-e129d87f91052f8772bb6171164cf631083ce3d4.zip
Explicitly change group to media
-rw-r--r--hel/recv-media.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/hel/recv-media.nix b/hel/recv-media.nix
index 22374f01..5d2d2ea2 100644
--- a/hel/recv-media.nix
+++ b/hel/recv-media.nix
@@ -2,6 +2,7 @@
2, coreutils 2, coreutils
3, writeScriptBin 3, writeScriptBin
4, eject 4, eject
5, shadow
5, notifyUser ? "gkleen" 6, notifyUser ? "gkleen"
6, showTitle ? true 7, showTitle ? true
7, ffmpeg ? null 8, ffmpeg ? null
@@ -18,7 +19,7 @@ writeScriptBin "recv-media" ''
18 notify=${if notifyUser == null then "false" else "true"} 19 notify=${if notifyUser == null then "false" else "true"}
19 notifyUser=${if notifyUser == null then "" else notifyUser} 20 notifyUser=${if notifyUser == null then "" else notifyUser}
20 21
21 PATH=${eject}/bin:${coreutils}/bin:${if showTitle then ''${ffmpeg}/bin:${gnused}/bin:'' else ""}${wrapperDir} 22 PATH=${eject}/bin:${coreutils}/bin:${shadow}/bin:${if showTitle then ''${ffmpeg}/bin:${gnused}/bin:'' else ""}${wrapperDir}
22 23
23 exec 1> >(logger --id=$pid -t recv-media -p user.notice) 24 exec 1> >(logger --id=$pid -t recv-media -p user.notice)
24 exec 2> >(logger --id=$pid -t recv-media -p user.error) 25 exec 2> >(logger --id=$pid -t recv-media -p user.error)
@@ -36,6 +37,11 @@ writeScriptBin "recv-media" ''
36 $(echo ''${2}) 37 $(echo ''${2})
37 EOF 38 EOF
38 39
40 if [[ $(id -gn) != "media" ]]; then
41 printf "Primary group is %s, trying to switch to media..." $(id -gn)
42 exec -- sg media "$0 $*"
43 fi
44
39 ( 45 (
40 if ! cp -lnv --preserve=all "$1" "''${target}"; then 46 if ! cp -lnv --preserve=all "$1" "''${target}"; then
41 mkdir -pv $(dirname "''${tmpFile}") || exit 1 47 mkdir -pv $(dirname "''${tmpFile}") || exit 1