Phase 4a sub-commit 4: AppImageUpdate sidecar + appcast + checkForUpdates()
Wires in the option-(a) sidecar approach: the AppImage carries a
bundled AppImageUpdate AppImage and an embedded update-info string
in the .upd_info ELF section. BackendConnection drives both the
check and the apply via QProcess.
BackendConnection:
- Q_INVOKABLE checkForUpdates()
Bundled mode only. Spawns AppImageUpdate.AppImage with
--check-for-update <APPIMAGE>. Exits 0 → noUpdatesAvailable,
1 → updatesAvailable, anything else → updateCheckFailed.
Dev mode: emits updateCheckFailed("…dev-mode only").
- Q_INVOKABLE applyUpdate()
Bundled mode only. Spawns AppImageUpdate.AppImage with
--remove-old <APPIMAGE>. Replaces the running AppImage in
place; user must restart. Emits updateApplied or
updateApplyFailed.
- Sidecar path resolves to applicationDirPath()/AppImageUpdate.AppImage
by default, overridable via BRIDGE_APPIMAGEUPDATE_BIN.
- APPIMAGE env (set by the AppImage runtime) determines the target
file. Outside an AppImage both methods fail loudly.
build-appimage.sh:
- Auto-downloads AppImageUpdate-x86_64.AppImage into the cached
tools dir and copies it into AppDir/usr/bin/AppImageUpdate.AppImage.
- New --update-info flag, forwarded to appimagetool's -u so the
.upd_info ELF section carries an "zsync|<URL>" string the sidecar
will fetch.
examples/todo Makefile forwards APPIMAGE_UPDATE_INFO env to the
script as --update-info.
release.yml:
- Builds the AppImage with APPIMAGE_UPDATE_INFO set to the canonical
Gitea Releases asset URL for this tag.
- Installs zsync, runs zsyncmake to generate Todo-x86_64.AppImage.zsync.
- Generates a JSON appcast (latest.json) with version / url / sha256 /
size / zsync URL / released_at — useful as an HTTP-fetchable
fallback for clients that prefer a structured manifest.
- SHA256SUMS now covers AppImage + zsync + latest.json.
- Uploads all four assets to the Gitea Release.
AppImage size grows from ~104 MB to ~152 MB with the sidecar bundled.
Embedding verified: objdump shows .upd_info populated with the
expected zsync URL after a local build.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,7 @@ CADDYFILE=""
|
||||
DESKTOP=""
|
||||
ICON=""
|
||||
OUTPUT=""
|
||||
UPDATE_INFO=""
|
||||
|
||||
usage() {
|
||||
cat <<USAGE >&2
|
||||
@@ -62,6 +63,7 @@ while [ $# -gt 0 ]; do
|
||||
--desktop) DESKTOP="$2"; shift 2 ;;
|
||||
--icon) ICON="$2"; shift 2 ;;
|
||||
--output) OUTPUT="$2"; shift 2 ;;
|
||||
--update-info) UPDATE_INFO="$2"; shift 2 ;;
|
||||
-h|--help) usage ;;
|
||||
*) echo "unknown arg: $1" >&2; usage ;;
|
||||
esac
|
||||
@@ -116,6 +118,13 @@ if [ ! -x "$APPIMAGETOOL" ]; then
|
||||
https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
|
||||
chmod +x "$APPIMAGETOOL"
|
||||
fi
|
||||
APPIMAGEUPDATE="$TOOLS_DIR/AppImageUpdate-x86_64.AppImage"
|
||||
if [ ! -x "$APPIMAGEUPDATE" ]; then
|
||||
step "Download AppImageUpdate sidecar"
|
||||
curl -fsSL -o "$APPIMAGEUPDATE" \
|
||||
https://github.com/AppImageCommunity/AppImageUpdate/releases/download/continuous/AppImageUpdate-x86_64.AppImage
|
||||
chmod +x "$APPIMAGEUPDATE"
|
||||
fi
|
||||
# Pre-cache the runtime file appimagetool needs; downloading it on every
|
||||
# build was wedging some networks during squashfs.
|
||||
RUNTIME_FILE="$TOOLS_DIR/runtime-x86_64"
|
||||
@@ -135,9 +144,10 @@ trap 'rm -rf "$(dirname "$APPDIR")"' EXIT INT TERM
|
||||
|
||||
step "Stage AppDir at $APPDIR"
|
||||
mkdir -p "$APPDIR/usr/bin" "$APPDIR/usr/share/$APP_NAME"
|
||||
install -m 0755 "$HOST_BIN" "$APPDIR/usr/bin/$APP_NAME"
|
||||
install -m 0755 "$FRANKENPHP" "$APPDIR/usr/bin/frankenphp"
|
||||
install -m 0644 "$CADDYFILE" "$APPDIR/usr/share/$APP_NAME/Caddyfile"
|
||||
install -m 0755 "$HOST_BIN" "$APPDIR/usr/bin/$APP_NAME"
|
||||
install -m 0755 "$FRANKENPHP" "$APPDIR/usr/bin/frankenphp"
|
||||
install -m 0755 "$APPIMAGEUPDATE" "$APPDIR/usr/bin/AppImageUpdate.AppImage"
|
||||
install -m 0644 "$CADDYFILE" "$APPDIR/usr/share/$APP_NAME/Caddyfile"
|
||||
|
||||
# Symfony tree: rsync without dev artefacts. Ensure composer ran with
|
||||
# --no-dev before building; this script doesn't re-run composer install.
|
||||
@@ -174,7 +184,14 @@ LD_LIBRARY_PATH="" \
|
||||
--plugin qt
|
||||
|
||||
step "appimagetool — squash AppDir into single-file AppImage"
|
||||
"$APPIMAGETOOL" --runtime-file "$RUNTIME_FILE" "$APPDIR" "$OUTPUT"
|
||||
APPIMAGETOOL_ARGS=(--runtime-file "$RUNTIME_FILE")
|
||||
if [ -n "$UPDATE_INFO" ]; then
|
||||
# Embed AppImageUpdate update-info string (e.g.
|
||||
# "zsync|https://example.com/Todo-x86_64.AppImage.zsync") into the
|
||||
# .upd_info ELF section so the bundled sidecar can find new releases.
|
||||
APPIMAGETOOL_ARGS+=(-u "$UPDATE_INFO")
|
||||
fi
|
||||
"$APPIMAGETOOL" "${APPIMAGETOOL_ARGS[@]}" "$APPDIR" "$OUTPUT"
|
||||
|
||||
echo
|
||||
echo "✓ AppImage at $OUTPUT"
|
||||
|
||||
Reference in New Issue
Block a user