diff --git a/entrypoint.sh b/entrypoint.sh index 3930a16a..99185c34 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,3 +1,21 @@ #!/bin/bash set -euo pipefail + +if mount -t binfmt_misc none /proc/sys/fs/binfmt_misc; then + case "$(uname -m)" in + "x86_64") + if [ ! -e /proc/sys/fs/binfmt_misc/qemu-aarch64 ]; then + cat /usr/lib/binfmt.d/qemu-aarch64-static.conf > /proc/sys/fs/binfmt_misc/register + fi + ;; + "aarch64") + if [ ! -e /proc/sys/fs/binfmt_misc/qemu-x86_64 ]; then + cat /usr/lib/binfmt.d/qemu-x86_64-static.conf > /proc/sys/fs/binfmt_misc/register + fi + esac +else + echo "WARN: cannot setup binfmt_misc handling" +fi + + /usr/bin/bootc-image-builder build --store /store --rpmmd /rpmmd --output /output "$@"