22
33set -ex
44
5- if [ -z " ${ARCHITECTURE} " ]; then
6- echo " Usage: env ARCHITECTURE=<arch> $0 "
5+ if [ -z " ${ALPINE_ARCH} " ]; then
6+ echo " Usage: env ALPINE_ARCH=<arch> $0 "
7+ echo " Example values: x86_64 x86 armhf aarch64"
78 exit 2
89fi
910
@@ -28,10 +29,10 @@ cd "$tempdir"
2829# Download and extract minimal Alpine system
2930# ############################################
3031
31- wget " http://dl-cdn.alpinelinux.org/alpine/v3.17/releases/${ARCHITECTURE } /alpine-minirootfs-3.17.2-${ARCHITECTURE } .tar.gz"
32+ wget " http://dl-cdn.alpinelinux.org/alpine/v3.17/releases/${ALPINE_ARCH } /alpine-minirootfs-3.17.2-${ALPINE_ARCH } .tar.gz"
3233mkdir -p ./miniroot
3334cd ./miniroot
34- sudo tar xf ../alpine-minirootfs-* -" ${ARCHITECTURE } " .tar.gz
35+ sudo tar xf ../alpine-minirootfs-* -" ${ALPINE_ARCH } " .tar.gz
3536cd -
3637
3738# ############################################
@@ -50,14 +51,14 @@ sudo cp -p /etc/resolv.conf miniroot/etc/
5051# Run build.sh in chroot
5152# ############################################
5253
53- if [ " $ARCHITECTURE " = " x86" ] || [ " $ARCHITECTURE " = " x86_64" ]; then
54+ if [ " $ALPINE_ARCH " = " x86" ] || [ " $ALPINE_ARCH " = " x86_64" ]; then
5455 echo " Architecture is x86 or x86_64, hence not using qemu-arm-static"
5556 sudo cp " $repo_root_dir " /chroot/build.sh miniroot/build.sh && sudo chroot miniroot /bin/sh -ex /build.sh
56- elif [ " $ARCHITECTURE " = " aarch64" ] ; then
57+ elif [ " $ALPINE_ARCH " = " aarch64" ] ; then
5758 echo " Architecture is aarch64, hence using qemu-aarch64-static"
5859 sudo cp " $( which qemu-aarch64-static) " miniroot/usr/bin
5960 sudo cp " $repo_root_dir " /chroot/build.sh miniroot/build.sh && sudo chroot miniroot qemu-aarch64-static /bin/sh -ex /build.sh
60- elif [ " $ARCHITECTURE " = " armhf" ] ; then
61+ elif [ " $ALPINE_ARCH " = " armhf" ] ; then
6162 echo " Architecture is armhf, hence using qemu-arm-static"
6263 sudo cp " $( which qemu-arm-static) " miniroot/usr/bin
6364 sudo cp " $repo_root_dir " /chroot/build.sh miniroot/build.sh && sudo chroot miniroot qemu-arm-static /bin/sh -ex /build.sh
7172# ############################################
7273
7374# Use the same architecture names as https://github.com/AppImage/AppImageKit/releases/
74- if [ " $ARCHITECTURE " = " x86" ] ; then ARCHITECTURE=i686 ; fi
75+ case " $ALPINE_ARCH " in
76+ x86)
77+ appimage_arch=i686
78+ ;;
79+ * )
80+ appimage_arch=" $ALPINE_ARCH "
81+ ;;
82+ esac
7583
7684cd " $repo_root_dir "
7785mkdir -p ./out/
78- sudo find " $tempdir " /miniroot/ -type f -executable -name ' runtime-fuse3' -exec cp {} " out/runtime-${ARCHITECTURE } " \;
86+ sudo find " $tempdir " /miniroot/ -type f -executable -name ' runtime-fuse3' -exec cp {} " out/runtime-${appimage_arch } " \;
0 commit comments