Fix bug introduced in previous commit

When building e.g. perl for the first time there is no perl in PATH yet,
so command -v perl will fail.

This brings back the previous behaviour of silently not patching
shebangs for which there is no available command in PATH.
This commit is contained in:
Bjørn Forsman 2013-12-03 16:58:49 +01:00
parent 7bf209db50
commit 88c7b4c7fe
1 changed files with 2 additions and 2 deletions

View File

@ -685,14 +685,14 @@ patchShebangs() {
echo "unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)"
exit 1
fi
newPath="$(command -v "$arg0")"
newPath="$(command -v "$arg0" || true)"
else
if [ "$oldPath" = "" ]; then
# If no interpreter is specified linux will use /bin/sh. Set
# oldpath="/bin/sh" so that we get /nix/store/.../sh.
oldPath="/bin/sh"
fi
newPath="$(command -v "$(basename "$oldPath")")"
newPath="$(command -v "$(basename "$oldPath")" || true)"
args="$arg0 $args"
fi