feat: add Flatpak packaging and private repo helpers

This commit is contained in:
Matteo Benedetto
2026-03-08 18:01:33 +01:00
parent 26deb509f6
commit f5216b1733
10 changed files with 222 additions and 3 deletions
+45
View File
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
APP_ID="net.enne2.Cellar"
BRANCH="stable"
MANIFEST="${ROOT_DIR}/net.enne2.Cellar.yaml"
BUILD_DIR="${ROOT_DIR}/flatpak-build"
REPO_DIR="${ROOT_DIR}/flatpak-repo"
BUNDLE_PATH="${ROOT_DIR}/dist/${APP_ID}.flatpak"
if ! command -v flatpak-builder >/dev/null 2>&1; then
echo "flatpak-builder not found. Install it first." >&2
exit 1
fi
if ! command -v flatpak >/dev/null 2>&1; then
echo "flatpak not found. Install it first." >&2
exit 1
fi
mkdir -p "${ROOT_DIR}/dist"
rm -rf "${BUILD_DIR}"
mkdir -p "${REPO_DIR}"
flatpak-builder \
--force-clean \
--repo="${REPO_DIR}" \
"${BUILD_DIR}" \
"${MANIFEST}"
flatpak build-bundle "${REPO_DIR}" "${BUNDLE_PATH}" "${APP_ID}" "${BRANCH}"
cat <<EOF
Flatpak repository ready:
${REPO_DIR}
Flatpak bundle ready:
${BUNDLE_PATH}
Example private remote setup:
flatpak remote-add --if-not-exists --user --no-gpg-verify brain-local http://brain.local/flatpak/cellar
flatpak install --user brain-local ${APP_ID}
EOF
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -lt 2 || $# -gt 3 ]]; then
echo "Usage: $0 <host> <remote-path> [public-url]" >&2
exit 1
fi
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
REPO_DIR="${ROOT_DIR}/flatpak-repo"
HOST="$1"
REMOTE_PATH="$2"
PUBLIC_URL="${3:-}"
if [[ ! -d "${REPO_DIR}" ]]; then
echo "Repository not found at ${REPO_DIR}. Run ./scripts/build-flatpak-repo.sh first." >&2
exit 1
fi
if ! command -v rsync >/dev/null 2>&1; then
echo "rsync not found. Install it first." >&2
exit 1
fi
rsync -av --delete "${REPO_DIR}/" "${HOST}:${REMOTE_PATH%/}/"
if [[ -n "${PUBLIC_URL}" ]]; then
cat <<EOF
Published to ${HOST}:${REMOTE_PATH}
Clients can add the remote with:
flatpak remote-add --if-not-exists --user --no-gpg-verify brain-local ${PUBLIC_URL}
EOF
else
echo
echo "Published to ${HOST}:${REMOTE_PATH}"
fi