mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 23:22:37 +00:00
Merge pull request #24944 from ahmedtd/make-makewrapper-picky
makeWrapper: Fail loudly when misused
This commit is contained in:
commit
67f37b70e8
@ -1,3 +1,12 @@
|
||||
# Assert that FILE exists and is executable
|
||||
#
|
||||
# assertExecutable FILE
|
||||
assertExecutable() {
|
||||
local file="$1"
|
||||
[[ -f "${file}" && -x "${file}" ]] || \
|
||||
die "Cannot wrap ${file} because it is not an executable file"
|
||||
}
|
||||
|
||||
# construct an executable file that wraps the actual executable
|
||||
# makeWrapper EXECUTABLE ARGS
|
||||
|
||||
@ -24,6 +33,8 @@ makeWrapper() {
|
||||
local params varName value command separator n fileNames
|
||||
local argv0 flagsBefore flags
|
||||
|
||||
assertExecutable "${file}"
|
||||
|
||||
mkdir -p "$(dirname "$wrapper")"
|
||||
|
||||
echo "#! $SHELL -e" > "$wrapper"
|
||||
@ -119,6 +130,9 @@ filterExisting() {
|
||||
wrapProgram() {
|
||||
local prog="$1"
|
||||
local hidden
|
||||
|
||||
assertExecutable "${prog}"
|
||||
|
||||
hidden="$(dirname "$prog")/.$(basename "$prog")"-wrapped
|
||||
while [ -e "$hidden" ]; do
|
||||
hidden="${hidden}_"
|
||||
|
Loading…
Reference in New Issue
Block a user