From e129d87f91052f8772bb6171164cf631083ce3d4 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 30 May 2017 13:33:21 +0200 Subject: Explicitly change group to media --- hel/recv-media.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 @@ , coreutils , writeScriptBin , eject +, shadow , notifyUser ? "gkleen" , showTitle ? true , ffmpeg ? null @@ -18,7 +19,7 @@ writeScriptBin "recv-media" '' notify=${if notifyUser == null then "false" else "true"} notifyUser=${if notifyUser == null then "" else notifyUser} - PATH=${eject}/bin:${coreutils}/bin:${if showTitle then ''${ffmpeg}/bin:${gnused}/bin:'' else ""}${wrapperDir} + PATH=${eject}/bin:${coreutils}/bin:${shadow}/bin:${if showTitle then ''${ffmpeg}/bin:${gnused}/bin:'' else ""}${wrapperDir} exec 1> >(logger --id=$pid -t recv-media -p user.notice) exec 2> >(logger --id=$pid -t recv-media -p user.error) @@ -36,6 +37,11 @@ writeScriptBin "recv-media" '' $(echo ''${2}) EOF + if [[ $(id -gn) != "media" ]]; then + printf "Primary group is %s, trying to switch to media..." $(id -gn) + exec -- sg media "$0 $*" + fi + ( if ! cp -lnv --preserve=all "$1" "''${target}"; then mkdir -pv $(dirname "''${tmpFile}") || exit 1 -- cgit v1.2.3