Skip to content

Commit

Permalink
zfs: extend zpool scripts with :$PATH, remove sudo
Browse files Browse the repository at this point in the history
sudo the package is not suid, so remove it from the PATH. Extend
PATH with $PATH to fetch sudo from the outer PATH. Move the generation
of `path` in to Nix, so the sed expression can use single quotes,
which prevents $PATH being interpolated at build-time.
  • Loading branch information
grahamc committed Nov 10, 2020
1 parent 24c8927 commit b3d4f5d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkgs/os-specific/linux/zfs/default.nix
Expand Up @@ -161,10 +161,11 @@ let
(cd $out/share/bash-completion/completions; ln -s zfs zpool)
'';

postFixup = ''
path="PATH=${makeBinPath [ coreutils gawk gnused gnugrep utillinux smartmontools sysstat sudo ]}"
postFixup = let
path = "PATH=${makeBinPath [ coreutils gawk gnused gnugrep utillinux smartmontools sysstat ]}:$PATH";
in ''
for i in $out/libexec/zfs/zpool.d/*; do
sed -i "2i$path" $i
sed -i '2i${path}' $i
done
'';

Expand Down

0 comments on commit b3d4f5d

Please sign in to comment.