export/fuse: Let permissions be adjustable
[qemu.git] / scripts / entitlement.sh
blobd2a7079ce3e9ab89998a799e48caea80bd25f4bf
1 #!/bin/sh -e
3 # Helper script for the build process to apply entitlements
5 in_place=:
6 if [ "$1" = --install ]; then
7 shift
8 in_place=false
9 fi
11 SRC="$1"
12 DST="$2"
13 ENTITLEMENT="$3"
14 ICON="$4"
16 if $in_place; then
17 trap 'rm "$DST.tmp"' exit
18 cp -af "$SRC" "$DST.tmp"
19 SRC="$DST.tmp"
20 else
21 cd "$MESON_INSTALL_DESTDIR_PREFIX"
24 if test "$ENTITLEMENT" != '/dev/null'; then
25 codesign --entitlements "$ENTITLEMENT" --force -s - "$SRC"
28 # Add the QEMU icon to the binary on Mac OS
29 Rez -append "$ICON" -o "$SRC"
30 SetFile -a C "$SRC"
32 mv -f "$SRC" "$DST"
33 trap '' exit