feat(packaging): add AppImage build script, AppDir metadata, and systemd service unit

This commit is contained in:
2026-10-02 17:10:00 +03:00
parent 2194c28ab5
commit 08fa97da8f
5 changed files with 81 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
set -e
HERE="$(dirname "$(readlink -f "$0")")"
export PATH="$HERE/usr/bin:$PATH"
export XDG_DATA_DIRS="$HERE/usr/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
case "$1" in
daemon)
shift
exec "$HERE/usr/bin/blocker-daemon" "$@"
;;
ui)
shift
exec "$HERE/usr/bin/blocker-ui" "$@"
;;
*)
exec "$HERE/usr/bin/blocker-daemon" "$@"
;;
esac
+8
View File
@@ -0,0 +1,8 @@
[Desktop Entry]
Name=Blocker
Comment=Focus and app blocking daemon
Exec=AppRun
Icon=blocker
Type=Application
Categories=Utility;
Terminal=true
+5
View File
@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
<circle cx="32" cy="32" r="30" fill="#2d3748" stroke="#4a5568" stroke-width="2"/>
<circle cx="32" cy="32" r="22" fill="none" stroke="#e53e3e" stroke-width="4"/>
<line x1="16" y1="16" x2="48" y2="48" stroke="#e53e3e" stroke-width="4"/>
</svg>

After

Width:  |  Height:  |  Size: 332 B

+13
View File
@@ -0,0 +1,13 @@
[Unit]
Description=Blocker Focus Daemon
PartOf=graphical-session.target
After=graphical-session.target
[Service]
Type=simple
ExecStart=%h/.local/bin/blocker-daemon
Restart=always
RestartSec=3
[Install]
WantedBy=graphical-session.target
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
# Build an AppImage packaging blocker-daemon, blocker-ui and assets.
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
DIST_DIR="$ROOT_DIR/dist"
APPDIR="$DIST_DIR/AppDir"
PKG_DIR="$ROOT_DIR/packaging/appimage"
echo "Building release binaries..."
cargo build --release -p blocker-daemon -p blocker-ui
echo "Preparing AppDir structure..."
mkdir -p "$APPDIR"
mkdir -p "$APPDIR/usr/bin"
mkdir -p "$APPDIR/usr/share/applications"
mkdir -p "$APPDIR/usr/share/icons/hicolor/scalable/apps"
cp "$ROOT_DIR/target/release/blocker-daemon" "$APPDIR/usr/bin/"
cp "$ROOT_DIR/target/release/blocker-ui" "$APPDIR/usr/bin/"
cp "$PKG_DIR/AppRun" "$APPDIR/AppRun"
cp "$PKG_DIR/blocker.desktop" "$APPDIR/blocker.desktop"
cp "$PKG_DIR/blocker.desktop" "$APPDIR/usr/share/applications/"
cp "$PKG_DIR/blocker.svg" "$APPDIR/blocker.svg"
cp "$PKG_DIR/blocker.svg" "$APPDIR/usr/share/icons/hicolor/scalable/apps/"
chmod +x "$APPDIR/AppRun"
OUTPUT_APPIMAGE="$DIST_DIR/Blocker-x86_64.AppImage"
rm -f "$OUTPUT_APPIMAGE"
echo "Creating AppImage with mksquashfs..."
mksquashfs "$APPDIR" "$OUTPUT_APPIMAGE" -root-owned -noappend -comp xz
echo "Built AppImage: $OUTPUT_APPIMAGE"
ls -lh "$OUTPUT_APPIMAGE"