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.
commitb3d4f5dada2264dc55e55717ce33589536908c00
authorGraham Christensen <graham@grahamc.com>
dateTue 10 Nov 2020, 08:48 (6 years ago)
parent24c8927
pkgs/os-specific/linux/zfs/default.nix+4−3
@@ -161,10 +161,11 @@ let
161161 (cd $out/share/bash-completion/completions; ln -s zfs zpool)
162162 '';
163163
164− postFixup = ''
165− path="PATH=${makeBinPath [ coreutils gawk gnused gnugrep utillinux smartmontools sysstat sudo ]}"
164+ postFixup = let
165+ path = "PATH=${makeBinPath [ coreutils gawk gnused gnugrep utillinux smartmontools sysstat ]}:$PATH";
166+ in ''
166167 for i in $out/libexec/zfs/zpool.d/*; do
167− sed -i "2i$path" $i
168+ sed -i '2i${path}' $i
168169 done
169170 '';
170171