- Base ubuntu:24.04 (fex-emu PPA has no Debian series) - setup-arm64: installs fex-emu(+thunks) from ppa:fex-emu/fex and bakes the Ubuntu 24.04 x86_64 RootFS (unsquashed to /opt/fex-emu-rootfs) into the image - bedrock-entry.sh: USE_FEX=true (default on FEX builds) execs FEXInterpreter; FEX_EMU_DIR for JIT caches stays volume-friendly; box64 path kept as fallback - amd64 builds untouched (native exec)
53 lines
1.7 KiB
Bash
Executable File
53 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
if [ "$TARGETARCH" != "arm64" ] ; then
|
|
exit 0
|
|
fi
|
|
|
|
EMULATOR="${EMULATOR:-fex}"
|
|
apt-get update
|
|
|
|
if [ "$EMULATOR" = "box64" ] ; then
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y debian-keyring
|
|
|
|
curl -L https://ryanfortner.github.io/box64-debs/box64.list -o /etc/apt/sources.list.d/box64.list
|
|
curl -L https://ryanfortner.github.io/box64-debs/KEY.gpg | gpg --dearmor | tee /etc/apt/trusted.gpg.d/box64-debs-archive-keyring.gpg
|
|
|
|
apt-get update
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
|
"$BOX64_PACKAGE" \
|
|
libjemalloc2
|
|
else
|
|
# FEX-Emu: comes from the official PPA (arm64 builds), Ubuntu base required
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
|
software-properties-common \
|
|
squashfs-tools \
|
|
ca-certificates \
|
|
curl
|
|
|
|
add-apt-repository -y ppa:fex-emu/fex
|
|
apt-get update
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
|
fex-emu \
|
|
libjemalloc2
|
|
|
|
# Thunks are optional but speed up glibc-heavy servers
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y fex-emu-thunks 2>/dev/null || true
|
|
|
|
# Bake the x86_64 RootFS into the image so the container is fully self-contained
|
|
# (no FEXRootFSFetcher at first start, no network needed at runtime)
|
|
ROOTFS_URL=$(curl -fsSL https://rootfs.fex-emu.gg/RootFS_links.json \
|
|
| python3 -c "import json,sys; d=json.load(sys.stdin)['v1']; print(d['Ubuntu 24.04 (SquashFS)']['URL'])")
|
|
echo "Fetching FEX RootFS from $ROOTFS_URL"
|
|
curl -fsSL "$ROOTFS_URL" -o /tmp/fex-rootfs.sqsh
|
|
|
|
# Extracted instead of mounted: works in containers without FUSE/SYS_ADMIN
|
|
mkdir -p /opt/fex-emu-rootfs
|
|
unsquashfs -q -d /opt/fex-emu-rootfs/rootfs /tmp/fex-rootfs.sqsh
|
|
rm -f /tmp/fex-rootfs.sqsh
|
|
fi
|
|
|
|
apt-get clean
|
|
rm -rf /var/lib/apt/lists/* |