diff --git a/pkgs/os-specific/linux/libcap/progs-bash-path.patch b/pkgs/os-specific/linux/libcap/progs-bash-path.patch deleted file mode 100644 index 359d95400fa6..000000000000 --- a/pkgs/os-specific/linux/libcap/progs-bash-path.patch +++ /dev/null @@ -1,15 +0,0 @@ -this patch set the bash path from '/bin/bash' to '/var/run/current-system/sw/bin/bash' - -diff --git a/progs/capsh.c b/progs/capsh.c -index 52336d7..fd98a03 100644 ---- a/progs/capsh.c -+++ b/progs/capsh.c -@@ -556,7 +556,7 @@ int main(int argc, char *argv[], char *envp[]) - } - printf("\n"); - } else if ((!strcmp("--", argv[i])) || (!strcmp("==", argv[i]))) { -- argv[i] = strdup(argv[i][0] == '-' ? "/bin/bash" : argv[0]); -+ argv[i] = strdup(argv[i][0] == '-' ? "/var/run/current-system/sw/bin/bash" : argv[0]); - argv[argc] = NULL; - execve(argv[i], argv+i, envp); - fprintf(stderr, "execve /bin/bash failed!\n"); diff --git a/pkgs/os-specific/linux/libcap/progs.nix b/pkgs/os-specific/linux/libcap/progs.nix index c287c4379586..9b2a8b69c3ca 100644 --- a/pkgs/os-specific/linux/libcap/progs.nix +++ b/pkgs/os-specific/linux/libcap/progs.nix @@ -9,7 +9,10 @@ stdenv.mkDerivation rec { buildInputs = [ libcap ]; - patches = [ ./progs-bash-path.patch ]; + prePatch = '' + BASH=$(type -tp bash) + substituteInPlace progs/capsh.c --replace "/bin/bash" "$BASH" + ''; preConfigure = "cd progs";