diff options
Diffstat (limited to 'hel')
-rw-r--r-- | hel/recv-media.nix | 8 |
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 |