Skip to content

Commit 9876371

Browse files
committed
Fix AppImage build
1 parent 6d5a0a4 commit 9876371

File tree

2 files changed

+45
-10
lines changed

2 files changed

+45
-10
lines changed

ci/build-appimage.sh

+22-1
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,38 @@ AIK_ARCH="$ARCH"
4545

4646
bash "$REPO_ROOT"/ci/build-bundle.sh
4747

48-
mv linuxdeploy-plugin-appimage-bundle AppDir
48+
mv linuxdeploy-plugin-appimage-bundle AppDir/
49+
50+
# cannot use a simple symlink because the AppRun script in appimagetool does not use bash and cannot use $BASH_SOURCE
51+
# therefore, a symlink would alter $0, causing the script to detect the wrong path
52+
# we use a similar script here to avoid this AppImage from depending on bash
53+
cat > AppDir/usr/bin/appimagetool <<\EOF
54+
#! /bin/bash
55+
set -euo pipefail
56+
57+
this_dir="$(readlink -f "$(dirname "$0")")"
58+
59+
# make appimagetool prefer the bundled mksquashfs
60+
export PATH="$this_dir"/usr/bin:"$PATH"
61+
62+
exec "$this_dir"/../../linuxdeploy-plugin-appimage-bundle/usr/bin/appimagetool "$@"
63+
64+
EOF
65+
chmod +x AppDir/usr/bin/appimagetool
4966

5067
wget https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-"$ARCH".AppImage
5168
chmod +x linuxdeploy-"$ARCH".AppImage
5269

70+
# qemu is not happy about the AppImage type 2 magic bytes, so we need to "fix" that
71+
dd if=/dev/zero bs=1 count=3 seek=8 conv=notrunc of=linuxdeploy-"$ARCH".AppImage
72+
5373
export UPD_INFO="gh-releases-zsync|linuxdeploy|linuxdeploy-plugin-appimage|continuous|linuxdeploy-plugin-appimage-$ARCH.AppImage"
5474

5575
# deploy linuxdeploy-plugin-appimage
5676
./linuxdeploy-"$ARCH".AppImage --appimage-extract-and-run \
5777
--appdir AppDir -d "$REPO_ROOT"/resources/linuxdeploy-plugin-appimage.desktop \
5878
-i "$REPO_ROOT"/resources/linuxdeploy-plugin-appimage.svg
79+
find AppDir
5980

6081
AppDir/AppRun --appdir AppDir
6182

ci/build-in-docker.sh

+23-9
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,31 @@ uid="$(id -u)"
3838
# make sure Docker image is up to date
3939
docker pull --platform "$platform" "$image"
4040

41+
extra_args=()
42+
[[ -t 0 ]] && extra_args+=("-t")
43+
44+
tmpfile="$(mktemp -t linuxdeploy-plugin-appimage-build-XXXXX.sh)"
45+
cleanup() {
46+
if [[ -f "$tmpfile" ]]; then
47+
rm "$tmpfile"
48+
fi
49+
}
50+
51+
cat > "$tmpfile" <<\EOF
52+
set -euxo pipefail
53+
54+
apt-get update
55+
apt-get install -y gcc g++ cmake git wget file curl ninja-build
56+
57+
bash -euxo pipefail ci/build-appimage.sh
58+
EOF
59+
60+
4161
docker run \
4262
--platform "$platform" \
4363
--rm \
4464
-i \
65+
"${extra_args[@]}" \
4566
-e ARCH \
4667
-e GITHUB_ACTIONS \
4768
-e GITHUB_RUN_NUMBER \
@@ -50,13 +71,6 @@ docker run \
5071
-v "$PWD":/out \
5172
-w /out \
5273
--tmpfs /docker-ramdisk:exec,mode=777 \
74+
-v "$tmpfile":/linuxdeploy-plugin-appimage-build.sh:ro \
5375
"$image" \
54-
bash -exo pipefail \
55-
<<\EOF
56-
57-
apt-get update
58-
apt-get install -y gcc g++ cmake git wget file curl ninja-build
59-
60-
bash -euxo pipefail ci/build-appimage.sh
61-
62-
EOF
76+
bash /linuxdeploy-plugin-appimage-build.sh

0 commit comments

Comments
 (0)