#!/bin/sh12# SPDX-FileCopyrightText: Copyright The Lima Authors3# SPDX-License-Identifier: Apache-2.045# This script fixes the signature of QEMU binary with the "com.apple.security.hypervisor" entitlement.6#7# A workaround for "QEMU (homebrew) is broken on Intel: `[hostagent] Driver stopped due to error: "signal: abort trap"` ..."8#9# https://github.com/lima-vm/lima/issues/174210# https://github.com/Homebrew/homebrew-core/issues/1402441112set -eux1314cat >entitlements.xml <<EOF15<?xml version="1.0" encoding="UTF-8"?>16<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">17<plist version="1.0">18<dict>19<key>com.apple.security.hypervisor</key>20<true/>21</dict>22</plist>23EOF2425codesign --sign - --entitlements entitlements.xml --force "$(which qemu-system-"$(uname -m | sed -e s/arm64/aarch64/)")"2627rm -f entitlements.xml282930