darwin: wrap strip and install_name_tool to codesign modified files
Co-authored-by: Moritz Angermann <moritz.angermann@gmail.com>
This commit is contained in:
co-authored by
Moritz Angermann
parent
7eb1e3695d
commit
772b66531a
@@ -0,0 +1,49 @@
|
||||
#! @shell@
|
||||
# shellcheck shell=bash
|
||||
|
||||
set -eu -o pipefail +o posix
|
||||
shopt -s nullglob
|
||||
|
||||
if (( "${NIX_DEBUG:-0}" >= 7 )); then
|
||||
set -x
|
||||
fi
|
||||
|
||||
source @signingUtils@
|
||||
|
||||
extraAfter=()
|
||||
extraBefore=()
|
||||
params=("$@")
|
||||
|
||||
input=
|
||||
|
||||
pprev=
|
||||
prev=
|
||||
for p in \
|
||||
${extraBefore+"${extraBefore[@]}"} \
|
||||
${params+"${params[@]}"} \
|
||||
${extraAfter+"${extraAfter[@]}"}
|
||||
do
|
||||
if [ "$pprev" != "-change" ] && [[ "$prev" != -* ]] && [[ "$p" != -* ]]; then
|
||||
input="$p"
|
||||
fi
|
||||
pprev="$prev"
|
||||
prev="$p"
|
||||
done
|
||||
|
||||
# Optionally print debug info.
|
||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||
# Old bash workaround, see above.
|
||||
echo "extra flags before to @prog@:" >&2
|
||||
printf " %q\n" ${extraBefore+"${extraBefore[@]}"} >&2
|
||||
echo "original flags to @prog@:" >&2
|
||||
printf " %q\n" ${params+"${params[@]}"} >&2
|
||||
echo "extra flags after to @prog@:" >&2
|
||||
printf " %q\n" ${extraAfter+"${extraAfter[@]}"} >&2
|
||||
fi
|
||||
|
||||
@prog@ \
|
||||
${extraBefore+"${extraBefore[@]}"} \
|
||||
${params+"${params[@]}"} \
|
||||
${extraAfter+"${extraAfter[@]}"}
|
||||
|
||||
sign "$input"
|
||||
Reference in New Issue
Block a user