#!/bin/bash set -euo pipefail source "$(dirname "$0")/versions.sh" RUNTIME="org.freedesktop.Platform" SDK="org.freedesktop.Sdk" BASEAPP="org.electronjs.Electron2.BaseApp" APP_ID="nz.scuttlebutt.Patchwork" MANIFEST="nz.scuttlebutt.Patchwork.yaml" REPO="repo" BUILD_DIR="build-dir" # 1. Install build dependencies (runtime, SDK and Electron base app) flatpak install -y flathub \ "${RUNTIME}//${RUNTIME_VERSION}" \ "${SDK}//${RUNTIME_VERSION}" \ "${BASEAPP}//${RUNTIME_VERSION}" # 2. Build the bundle if ! command -v flatpak-builder >/dev/null 2>&1; then echo "flatpak-builder is not installed." >&2 echo "Install it with one of:" >&2 echo " sudo apt install flatpak-builder" >&2 echo " flatpak install flathub org.flatpak.Builder" >&2 echo "If you used org.flatpak.Builder, run:" >&2 echo " flatpak run --command=flatpak-builder org.flatpak.Builder --repo=${REPO} --force-clean ${BUILD_DIR} ${MANIFEST}" >&2 exit 1 fi flatpak-builder --repo="${REPO}" --force-clean "${BUILD_DIR}" "${MANIFEST}" # 3. Install it into the current user flatpak --user remote-add --if-not-exists --no-gpg-verify patchwork-repo "${REPO}" flatpak --user install -y patchwork-repo "${APP_ID}" echo echo "Done. Run it with: flatpak run ${APP_ID}"