Files
driftwood/packaging/build-appimage.sh
lashman fa28955919 Implement Driftwood AppImage manager - Phases 1 and 2
Phase 1 - Application scaffolding:
- GTK4/libadwaita application window with AdwNavigationView
- GSettings-backed window state persistence
- GResource-compiled CSS and schema
- Library view with grid/list toggle, search, sorting, filtering
- Detail view with file info, desktop integration controls
- Preferences window with scan directories, theme, behavior settings
- CLI with list, scan, integrate, remove, clean, inspect commands
- AppImage discovery, metadata extraction, desktop integration
- Orphaned desktop entry detection and cleanup
- AppImage packaging script

Phase 2 - Intelligence layer:
- Database schema v2 with migration for status tracking columns
- FUSE detection engine (libfuse2/3, fusermount, /dev/fuse, AppImageLauncher)
- Wayland awareness engine (session type, toolkit detection, XWayland)
- Update info parsing from AppImage ELF sections (.upd_info)
- GitHub/GitLab Releases API integration for update checking
- Update download with progress tracking and atomic apply
- Launch wrapper with FUSE auto-detection and usage tracking
- Duplicate and multi-version detection with recommendations
- Dashboard with system health, library stats, disk usage
- Update check dialog (single and batch)
- Duplicate resolution dialog
- Status badges on library cards and detail view
- Extended CLI: status, check-updates, duplicates, launch commands

49 tests passing across all modules.
2026-02-26 23:04:27 +02:00

111 lines
3.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Build Driftwood as an AppImage using linuxdeploy
#
# Prerequisites:
# - Rust toolchain (cargo)
# - linuxdeploy (https://github.com/linuxdeploy/linuxdeploy)
# - linuxdeploy-plugin-gtk (for GTK4/libadwaita bundling)
#
# Usage:
# ./packaging/build-appimage.sh
#
# The resulting .AppImage will be in the project root.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
APP_ID="app.driftwood.Driftwood"
cd "$PROJECT_DIR"
echo "=== Building Driftwood (release) ==="
cargo build --release
echo "=== Preparing AppDir ==="
APPDIR="$PROJECT_DIR/AppDir"
rm -rf "$APPDIR"
mkdir -p "$APPDIR/usr/bin"
mkdir -p "$APPDIR/usr/share/applications"
mkdir -p "$APPDIR/usr/share/glib-2.0/schemas"
mkdir -p "$APPDIR/usr/share/icons/hicolor/scalable/apps"
# Binary
cp "target/release/driftwood" "$APPDIR/usr/bin/driftwood"
# Desktop file
cp "data/$APP_ID.desktop" "$APPDIR/usr/share/applications/$APP_ID.desktop"
# GSettings schema
cp "data/$APP_ID.gschema.xml" "$APPDIR/usr/share/glib-2.0/schemas/$APP_ID.gschema.xml"
glib-compile-schemas "$APPDIR/usr/share/glib-2.0/schemas/"
# Icon - use a placeholder SVG if no real icon exists yet
ICON_FILE="data/icons/$APP_ID.svg"
if [ -f "$ICON_FILE" ]; then
cp "$ICON_FILE" "$APPDIR/usr/share/icons/hicolor/scalable/apps/$APP_ID.svg"
else
echo "Warning: No app icon found at $ICON_FILE"
echo "Creating a minimal placeholder icon..."
cat > "$APPDIR/usr/share/icons/hicolor/scalable/apps/$APP_ID.svg" << 'SVGEOF'
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128">
<rect width="128" height="128" rx="16" fill="#3584e4"/>
<text x="64" y="78" font-family="sans-serif" font-size="64" font-weight="bold"
fill="white" text-anchor="middle">D</text>
</svg>
SVGEOF
fi
# Check for linuxdeploy
LINUXDEPLOY="${LINUXDEPLOY:-linuxdeploy}"
if ! command -v "$LINUXDEPLOY" &>/dev/null; then
# Try to find it in the current directory
if [ -x "./linuxdeploy-x86_64.AppImage" ]; then
LINUXDEPLOY="./linuxdeploy-x86_64.AppImage"
else
echo ""
echo "Error: linuxdeploy not found."
echo ""
echo "Download it from:"
echo " https://github.com/linuxdeploy/linuxdeploy/releases"
echo ""
echo "Then either:"
echo " 1. Place linuxdeploy-x86_64.AppImage in the project root, or"
echo " 2. Set LINUXDEPLOY=/path/to/linuxdeploy"
exit 1
fi
fi
# Check for GTK plugin
GTK_PLUGIN="${LINUXDEPLOY_PLUGIN_GTK:-}"
if [ -z "$GTK_PLUGIN" ]; then
if [ -x "./linuxdeploy-plugin-gtk.sh" ]; then
export DEPLOY_GTK_VERSION=4
else
echo ""
echo "Warning: linuxdeploy-plugin-gtk not found."
echo "GTK4 libraries will not be bundled."
echo "The AppImage may only work on systems with GTK4 and libadwaita installed."
echo ""
echo "Download the plugin from:"
echo " https://github.com/nickvdp/linuxdeploy-plugin-gtk"
echo ""
fi
fi
echo "=== Building AppImage ==="
export ARCH="x86_64"
export OUTPUT="Driftwood-x86_64.AppImage"
export GSETTINGS_SCHEMA_DIR="$APPDIR/usr/share/glib-2.0/schemas"
"$LINUXDEPLOY" \
--appdir "$APPDIR" \
--desktop-file "$APPDIR/usr/share/applications/$APP_ID.desktop" \
--icon-file "$APPDIR/usr/share/icons/hicolor/scalable/apps/$APP_ID.svg" \
--output appimage
echo ""
echo "=== Done ==="
echo "AppImage created: $OUTPUT"
echo "You can run it with: ./$OUTPUT"