aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/entitlement.sh20
1 files changed, 16 insertions, 4 deletions
diff --git a/scripts/entitlement.sh b/scripts/entitlement.sh
index c540fa6435..f7aaaf2766 100755
--- a/scripts/entitlement.sh
+++ b/scripts/entitlement.sh
@@ -2,12 +2,24 @@
#
# Helper script for the build process to apply entitlements
+in_place=:
+if [ "$1" = --install ]; then
+ shift
+ in_place=false
+fi
+
SRC="$1"
DST="$2"
ENTITLEMENT="$3"
-trap 'rm "$DST.tmp"' exit
-cp -af "$SRC" "$DST.tmp"
-codesign --entitlements "$ENTITLEMENT" --force -s - "$DST.tmp"
-mv "$DST.tmp" "$DST"
+if $in_place; then
+ trap 'rm "$DST.tmp"' exit
+ cp -af "$SRC" "$DST.tmp"
+ SRC="$DST.tmp"
+else
+ cd "$MESON_INSTALL_DESTDIR_PREFIX"
+fi
+
+codesign --entitlements "$ENTITLEMENT" --force -s - "$SRC"
+mv -f "$SRC" "$DST"
trap '' exit