Skip to content

Commit fc94023

Browse files
authored
Check userland rather kernel arch (#49)
Check userland rather kernel arch, closes #48 Since uname gives the kernel architecture but we need the userland architecture, we check /bin/bash
1 parent 4e159f7 commit fc94023

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

scripts/build-in-container.sh

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,22 @@ echo -ne 'AI\x02' | dd of=runtime-fuse3 bs=1 count=3 seek=8 conv=notrunc
3232
ls -lh runtime-fuse3
3333

3434
# append architecture prefix
35-
# since we expect to be built in a Dockerized environment, i.e., either run in a native environment or have it emulated transparently with QEMU, we can just use uname
35+
# since uname gives the kernel architecture but we need the userland architecture, we check /bin/bash
3636
# all we have to do is convert uname's expected output to AppImage's semi-official suffix style
37-
case "$(uname -m)" in
38-
x86_64)
39-
architecture=x86_64
40-
;;
41-
i386|i586|i686)
42-
architecture=i686
43-
;;
44-
aarch64|arm64v8)
45-
architecture=aarch64
46-
;;
47-
arm32v7|armv7l|armhf)
48-
architecture=armhf
49-
;;
50-
*)
51-
echo "Unsupported architecture: $(uname -m)"
52-
exit 2
53-
;;
54-
esac
37+
runtime=$(file -L /bin/bash)
38+
39+
if [[ $runtime =~ 80386 ]]; then
40+
architecture=i686
41+
elif [[ $runtime =~ aarch64 ]]; then
42+
architecture=aarch64
43+
elif [[ $runtime =~ EABI5 ]]; then
44+
architecture=armhf
45+
elif [[ $runtime =~ x86_64 ]]; then
46+
architecture=x86_64
47+
else
48+
echo "Unsupported architecture: ${runtime#* }"
49+
exit 2
50+
fi
5551

5652
mv runtime-fuse3 runtime-fuse3-"$architecture"
5753
cp runtime-fuse3-"$architecture" "$out_dir"/

0 commit comments

Comments
 (0)