From b3d4f5dada2264dc55e55717ce33589536908c00 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 10 Nov 2020 08:48:18 -0500 Subject: [PATCH] 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. --- pkgs/os-specific/linux/zfs/default.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/zfs/default.nix b/pkgs/os-specific/linux/zfs/default.nix index bb4a2dcf9796af..b9a8c83060b58c 100644 --- a/pkgs/os-specific/linux/zfs/default.nix +++ b/pkgs/os-specific/linux/zfs/default.nix @@ -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 '';