Files
swiftcontrol/linux/packaging/build_appimage.sh
Jonas Acker e6947c6894 Package Linux as .deb and AppImage, built in CI
- binary bikecontrol, application id app.bikecontrol.BikeControl
- .deb: /opt/bikecontrol, launcher, icon, bikecontrol:// handler and the
  udev rule for /dev/uinput; AppImage for other distros
- single instance, so a bikecontrol:// link reaches the running app
- CI builds on Ubuntu 22.04 (x64 via Shorebird, arm64) and publishes to
  the version's release and the rolling linux-latest release
- keypress_simulator_linux: no std::clamp (plugins build as C++14)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 14:26:39 +01:00

47 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Packages a `flutter build linux` / `shorebird release linux` bundle as an
# AppImage.
#
# linux/packaging/build_appimage.sh <bundle dir> <version> <x86_64|aarch64> <output dir>
#
# An AppImage cannot install the udev rule for /dev/uinput; the app explains
# the rule when the Local connection method needs it. Machines with Steam
# installed already have an equivalent rule.
set -euo pipefail
BUNDLE=$1
VERSION=$2
ARCH=$3
OUT=$4
HERE=$(cd "$(dirname "$0")" && pwd)
APP_ID=app.bikecontrol.BikeControl
WORK=$(mktemp -d)
trap 'rm -rf "$WORK"' EXIT
APPDIR=$WORK/BikeControl.AppDir
install -d "$APPDIR/usr/lib/bikecontrol" "$APPDIR/usr/share/applications" \
"$APPDIR/usr/share/icons/hicolor/512x512/apps"
cp -a "$BUNDLE"/. "$APPDIR/usr/lib/bikecontrol/"
install -m 644 "$HERE/$APP_ID.desktop" "$APPDIR/$APP_ID.desktop"
install -m 644 "$HERE/$APP_ID.desktop" "$APPDIR/usr/share/applications/$APP_ID.desktop"
install -m 644 "$HERE/$APP_ID.png" "$APPDIR/$APP_ID.png"
install -m 644 "$HERE/$APP_ID.png" "$APPDIR/usr/share/icons/hicolor/512x512/apps/$APP_ID.png"
ln -s "$APP_ID.png" "$APPDIR/.DirIcon"
cat > "$APPDIR/AppRun" <<'EOF'
#!/bin/sh
HERE=$(dirname "$(readlink -f "$0")")
exec "$HERE/usr/lib/bikecontrol/bikecontrol" "$@"
EOF
chmod 755 "$APPDIR/AppRun"
TOOL=$WORK/appimagetool
curl -fsSL -o "$TOOL" "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$ARCH.AppImage"
chmod 755 "$TOOL"
mkdir -p "$OUT"
# Extract-and-run: CI runners and containers have no FUSE.
ARCH=$ARCH VERSION=$VERSION "$TOOL" --appimage-extract-and-run --no-appstream \
"$APPDIR" "$OUT/BikeControl-linux-$ARCH.AppImage"