zfs: extend zpool scripts with :$PATH, remove sudo

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.
This commit is contained in:
Graham Christensen 2020-11-10 08:48:18 -05:00
parent 24c8927c4a
commit b3d4f5dada
No known key found for this signature in database
GPG key ID: FE918C3A98C1030F

View file

@ -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
'';