Add release packaging and automatic update support

This commit is contained in:
Elijah 2026-10-03 19:07:11 -07:00
parent 94cd6b984b
commit f971c374f8
20 changed files with 722 additions and 16 deletions

View file

@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -euo pipefail
# Install per-user, keeping the AppImage writable for in-app updates.
source_image="${1:?Usage: bash install-linux.sh /path/to/AstroFrame.AppImage}"
[[ -f "$source_image" ]] || { echo 'AppImage file does not exist.' >&2; exit 1; }
[[ "$(uname -m)" == x86_64 ]] || { echo 'This release requires an x64 PC.' >&2; exit 1; }
install_dir="${XDG_DATA_HOME:-$HOME/.local/share}/AstroFrame/app"
menu_dir="${XDG_DATA_HOME:-$HOME/.local/share}/applications"
icon_dir="${XDG_DATA_HOME:-$HOME/.local/share}/icons/hicolor/256x256/apps"
mkdir -p "$install_dir" "$menu_dir" "$icon_dir"
target="$install_dir/AstroFrame.AppImage"
if [[ -e "$target" && "$source_image" -ef "$target" ]]; then
chmod +x "$target"
else
install -m 755 "$source_image" "$target"
fi
script_dir="$(cd "$(dirname "$0")" && pwd)"
if [[ -f "$script_dir/astroframe.png" ]]; then
install -m 644 "$script_dir/astroframe.png" "$icon_dir/astroframe.png"
fi
# Use a wrapper so desktop files do not need to parse/escape user directory paths.
printf '#!/usr/bin/env bash\nexec %q "$@"\n' "$target" > "$install_dir/launch"
chmod +x "$install_dir/launch"
escaped_launcher="${install_dir//\\/\\\\}/launch"
escaped_launcher="${escaped_launcher//\"/\\\"}"
escaped_launcher="${escaped_launcher//\$/\\\$}"
escaped_launcher="${escaped_launcher//\`/\\\`}"
escaped_launcher="${escaped_launcher//%/%%}"
cat > "$menu_dir/astroframe.desktop" <<EOF
[Desktop Entry]
Type=Application
Name=AstroFrame
Comment=Select astrophotography light frames
Exec="$escaped_launcher" %U
Icon=astroframe
Terminal=false
Categories=Science;Astronomy;
StartupWMClass=AstroFrame.Desktop
EOF
chmod 644 "$menu_dir/astroframe.desktop"
if command -v update-desktop-database >/dev/null 2>&1; then update-desktop-database "$menu_dir"; fi
echo "Installed to $target. Launch AstroFrame from your application menu."