xref: /qemu/scripts/entitlement.sh (revision d7a84021)
1#!/bin/sh -e
2#
3# Helper script for the build process to apply entitlements
4
5in_place=:
6if [ "$1" = --install ]; then
7  shift
8  in_place=false
9fi
10
11SRC="$1"
12DST="$2"
13ENTITLEMENT="$3"
14
15if $in_place; then
16  trap 'rm "$DST.tmp"' exit
17  cp -af "$SRC" "$DST.tmp"
18  SRC="$DST.tmp"
19else
20  cd "$MESON_INSTALL_DESTDIR_PREFIX"
21fi
22
23codesign --entitlements "$ENTITLEMENT" --force -s - "$SRC"
24mv -f "$SRC" "$DST"
25trap '' exit
26