patchShebangs: Allow for multiple arguments
It's tempting to think patchShebangs supports multiple arguments. Without this patch it just silently ignores all but the first. Now it patches the shebangs in all of its arguments. Fixes: #57695
This commit is contained in:
parent
81d3bd60a4
commit
4a1e51f957
@ -9,8 +9,9 @@
|
|||||||
|
|
||||||
fixupOutputHooks+=(patchShebangsAuto)
|
fixupOutputHooks+=(patchShebangsAuto)
|
||||||
|
|
||||||
# Run patch shebangs on a directory.
|
# Run patch shebangs on a directory or file.
|
||||||
# patchShebangs [--build | --host] directory
|
# Can take multiple paths as arguments.
|
||||||
|
# patchShebangs [--build | --host] PATH...
|
||||||
|
|
||||||
# Flags:
|
# Flags:
|
||||||
# --build : Lookup commands available at build-time
|
# --build : Lookup commands available at build-time
|
||||||
@ -31,9 +32,7 @@ patchShebangs() {
|
|||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local dir="$1"
|
header "patching script interpreter paths in $@"
|
||||||
|
|
||||||
header "patching script interpreter paths in $dir"
|
|
||||||
local f
|
local f
|
||||||
local oldPath
|
local oldPath
|
||||||
local newPath
|
local newPath
|
||||||
@ -42,8 +41,6 @@ patchShebangs() {
|
|||||||
local oldInterpreterLine
|
local oldInterpreterLine
|
||||||
local newInterpreterLine
|
local newInterpreterLine
|
||||||
|
|
||||||
[ -e "$dir" ] || return 0
|
|
||||||
|
|
||||||
local f
|
local f
|
||||||
while IFS= read -r -d $'\0' f; do
|
while IFS= read -r -d $'\0' f; do
|
||||||
isScript "$f" || continue
|
isScript "$f" || continue
|
||||||
@ -97,7 +94,7 @@ patchShebangs() {
|
|||||||
rm "$timestamp"
|
rm "$timestamp"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done < <(find "$dir" -type f -perm -0100 -print0)
|
done < <(find "$@" -type f -perm -0100 -print0)
|
||||||
|
|
||||||
stopNest
|
stopNest
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user