Basic alpine chroot

This commit is contained in:
2026-03-22 00:59:37 +08:00
parent 66e985f09a
commit 64970aa459
5 changed files with 62 additions and 0 deletions

16
alpine/prepare-chroot.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
mkdir -p "$ROOTFS/var/cache/apk"
mount --bind /var/cache/apk "$ROOTFS/var/cache/apk"
mount --bind /dev "$ROOTFS/dev"
mount --bind /proc "$ROOTFS/proc"
mount --bind /sys "$ROOTFS/sys"
mount --bind /run "$ROOTFS/run"
cp /usr/bin/qemu-aarch64-static "$ROOTFS/usr/bin/"
cp /etc/resolv.conf "$ROOTFS/etc/resolv.conf"
chroot "$ROOTFS" /bin/sh -c "ln -s /var/cache/apk /etc/apk/cache"
chroot "$ROOTFS" /bin/sh -c "apk update; apk add bash curl"
cp "/build-rootfs.sh" "$ROOTFS/build-rootfs.sh"
chroot "$ROOTFS" /bin/bash /build-rootfs.sh