#!/bin/sh # Installs the Pipelines Linux desktop app for the current user from a release # archive (pipelines-linux-x64*.tar.gz from `./install --linux`, the build # cache or the update feed): # scripts/install-linux-app.sh # `./install --linux --install` builds the archive and runs this. # # The app lives in /lib/app-linux (prefix: $PIPELINES_PREFIX, default # ~/.local/share/pipelines), whose parent is writable so in-app updates can # swap it. A desktop entry named after the GTK application id # (com.pipelines.app.desktop) lets Wayland compositors, launchers and # notification daemons match the window and its icon; ~/.local/bin/pipelines-app # links the executable. An existing install is kept as app-linux.previous. set -eu archive=$1 data=${XDG_DATA_HOME:-$HOME/.local/share} prefix=${PIPELINES_PREFIX:-$HOME/.local/share/pipelines} target=$prefix/lib/app-linux app_id=com.pipelines.app mkdir -p "$prefix/lib" staging=$(mktemp -d "$prefix/lib/.app-linux-install.XXXXXX") trap 'rm -rf "$staging"' EXIT tar -xzf "$archive" -C "$staging" bundle=$(dirname "$(find "$staging" -maxdepth 3 -type f -name pipelines-app | head -n 1)") [ -x "$bundle/pipelines-app" ] && [ -d "$bundle/data/flutter_assets" ] && [ -d "$bundle/lib" ] || { echo "The archive has no complete pipelines-app bundle." >&2; exit 1; } missing=$(ldd "$bundle/pipelines-app" 2>/dev/null | grep "not found" || true) [ -z "$missing" ] || { echo "Missing system libraries:" >&2; echo "$missing" >&2; exit 1; } rm -rf "$target.previous" [ -d "$target" ] && mv "$target" "$target.previous" mv "$bundle" "$target" mkdir -p "$HOME/.local/bin" "$data/applications" ln -sf "$target/pipelines-app" "$HOME/.local/bin/pipelines-app" icon=$app_id if [ -f "$target/data/app_icon.png" ]; then mkdir -p "$data/icons/hicolor/512x512/apps" cp "$target/data/app_icon.png" "$data/icons/hicolor/512x512/apps/$app_id.png" else icon=utilities-terminal fi cat > "$data/applications/$app_id.desktop" </dev/null 2>&1 && update-desktop-database "$data/applications" >/dev/null 2>&1 || true echo "Installed Pipelines at $target" echo "Launcher: $data/applications/$app_id.desktop (run: pipelines-app)"