packaging: add install.sh, PKGBUILD, deb build, appimage recipe
POSIX sh one-liner installer that detects distro/GPU/session, builds from source with cargo, and sets up the engine's uv venv (CUDA torch only with an NVIDIA GPU). Plus packaging/arch/PKGBUILD, packaging/deb (built and verified locally), and an untested packaging/appimage recipe.
This commit is contained in:
1 parent
1442346605
commit
e7b0cc911d
7 files changed
+486
No files matched your search
Executable
+331
@@ -0,0 +1,331 @@
|
||||
#!/bin/sh
|
||||
# Summit installer for Linux.
|
||||
#
|
||||
# curl -fsSL https://git.molberg.cloud/alex/summit/raw/branch/main/install.sh | sh
|
||||
#
|
||||
# POSIX sh, no bashisms. Detects your distro, GPU vendor and display session,
|
||||
# installs the Summit launcher (native package if one exists for a tagged
|
||||
# release, otherwise builds from source with cargo) and sets up the engine's
|
||||
# Python virtualenv (uv, Python 3.12, CUDA 12.8 torch only if an NVIDIA GPU
|
||||
# is present).
|
||||
#
|
||||
# Flags:
|
||||
# --yes, -y don't ask before sudo steps
|
||||
# --dry-run print what would happen, change nothing
|
||||
# --uninstall remove what this installer installed
|
||||
# --help, -h show this message
|
||||
|
||||
set -eu
|
||||
|
||||
REPO_API="https://git.molberg.cloud/api/v1/repos/alex/summit"
|
||||
REPO_GIT="https://git.molberg.cloud/alex/summit.git"
|
||||
PREFIX="${SUMMIT_PREFIX:-/usr/local}"
|
||||
SHARE_DIR="$PREFIX/share/summit"
|
||||
BIN_DIR="$PREFIX/bin"
|
||||
SRC_DIR="${SUMMIT_SRC_DIR:-$HOME/.cache/summit/src}"
|
||||
|
||||
ASSUME_YES=0
|
||||
DRY_RUN=0
|
||||
UNINSTALL=0
|
||||
|
||||
log() { printf '%s\n' "$*"; }
|
||||
step() { printf '\n==> %s\n' "$*"; }
|
||||
die() { printf 'error: %s\n' "$*" >&2; exit 1; }
|
||||
|
||||
run() {
|
||||
# Print the command, then execute it unless --dry-run.
|
||||
printf ' $ %s\n' "$*"
|
||||
if [ "$DRY_RUN" -eq 0 ]; then
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
run_sudo() {
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
run "$@"
|
||||
return
|
||||
fi
|
||||
if [ "$ASSUME_YES" -eq 0 ] && [ "$DRY_RUN" -eq 0 ]; then
|
||||
printf ' needs sudo: %s\n' "$*"
|
||||
printf ' proceed? [y/N] '
|
||||
read -r reply
|
||||
case "$reply" in
|
||||
y|Y|yes|YES) ;;
|
||||
*) die "aborted before: $*" ;;
|
||||
esac
|
||||
fi
|
||||
run sudo "$@"
|
||||
}
|
||||
|
||||
usage() {
|
||||
sed -n '2,20p' "$0" | sed 's/^# \{0,1\}//'
|
||||
}
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--yes|-y) ASSUME_YES=1 ;;
|
||||
--dry-run) DRY_RUN=1 ;;
|
||||
--uninstall) UNINSTALL=1 ;;
|
||||
--help|-h) usage; exit 0 ;;
|
||||
*) die "unknown flag: $arg (see --help)" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Detection
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
DISTRO_ID=unknown
|
||||
DISTRO_FAMILY=unknown # arch, debian, fedora, opensuse
|
||||
|
||||
detect_distro() {
|
||||
if [ -r /etc/os-release ]; then
|
||||
# shellcheck disable=SC1091
|
||||
. /etc/os-release
|
||||
DISTRO_ID="${ID:-unknown}"
|
||||
ID_LIKE_VAL="${ID_LIKE:-}"
|
||||
else
|
||||
DISTRO_ID=unknown
|
||||
ID_LIKE_VAL=""
|
||||
fi
|
||||
|
||||
case "$DISTRO_ID $ID_LIKE_VAL" in
|
||||
*arch*|*cachyos*|*manjaro*) DISTRO_FAMILY=arch ;;
|
||||
*debian*|*ubuntu*|*neon*|*linuxmint*|*mint*) DISTRO_FAMILY=debian ;;
|
||||
*fedora*) DISTRO_FAMILY=fedora ;;
|
||||
*opensuse*|*suse*) DISTRO_FAMILY=opensuse ;;
|
||||
*)
|
||||
case "$DISTRO_ID" in
|
||||
arch|cachyos|manjaro) DISTRO_FAMILY=arch ;;
|
||||
debian|ubuntu|neon|linuxmint) DISTRO_FAMILY=debian ;;
|
||||
fedora) DISTRO_FAMILY=fedora ;;
|
||||
opensuse*|sles) DISTRO_FAMILY=opensuse ;;
|
||||
*) DISTRO_FAMILY=unknown ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
GPU_VENDOR=unknown # nvidia, amd, intel, none
|
||||
|
||||
detect_gpu() {
|
||||
GPU_VENDOR=none
|
||||
if ! command -v lspci >/dev/null 2>&1; then
|
||||
return
|
||||
fi
|
||||
pci_vga="$(lspci -nn 2>/dev/null | grep -Ei 'vga|3d controller|display controller' || true)"
|
||||
case "$pci_vga" in
|
||||
*[Nn][Vv][Ii][Dd][Ii][Aa]*) GPU_VENDOR=nvidia ;;
|
||||
*) case "$pci_vga" in
|
||||
*[Aa][Mm][Dd]*|*[Aa][Tt][Ii]*|*[Rr]adeon*) GPU_VENDOR=amd ;;
|
||||
*) case "$pci_vga" in
|
||||
*[Ii]ntel*) GPU_VENDOR=intel ;;
|
||||
*) GPU_VENDOR=none ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
SESSION_TYPE=unknown # wayland, x11
|
||||
|
||||
detect_session() {
|
||||
if [ -n "${XDG_SESSION_TYPE:-}" ]; then
|
||||
SESSION_TYPE="$XDG_SESSION_TYPE"
|
||||
elif [ -n "${WAYLAND_DISPLAY:-}" ]; then
|
||||
SESSION_TYPE=wayland
|
||||
elif [ -n "${DISPLAY:-}" ]; then
|
||||
SESSION_TYPE=x11
|
||||
else
|
||||
SESSION_TYPE=unknown
|
||||
fi
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Package manager glue
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
install_dependencies() {
|
||||
step "Installing build and runtime dependencies for $DISTRO_FAMILY"
|
||||
case "$DISTRO_FAMILY" in
|
||||
arch)
|
||||
run_sudo pacman -Sy --needed --noconfirm base-devel git curl pkgconf
|
||||
;;
|
||||
debian)
|
||||
run_sudo apt-get update
|
||||
run_sudo apt-get install -y build-essential git curl pkg-config libssl-dev
|
||||
;;
|
||||
fedora)
|
||||
run_sudo dnf install -y @development-tools git curl pkgconf-pkg-config openssl-devel
|
||||
;;
|
||||
opensuse)
|
||||
run_sudo zypper install -y -t pattern devel_basis
|
||||
run_sudo zypper install -y git curl pkg-config libopenssl-devel
|
||||
;;
|
||||
*)
|
||||
log " unrecognized distro family ($DISTRO_ID) — skipping package manager, assuming build tools are present"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
ensure_rust() {
|
||||
if command -v cargo >/dev/null 2>&1; then
|
||||
return
|
||||
fi
|
||||
step "Rust toolchain not found, installing with rustup"
|
||||
run sh -c 'curl -fsSL https://sh.rustup.rs | sh -s -- -y'
|
||||
RUSTUP_ENV="$HOME/.cargo/env"
|
||||
if [ -r "$RUSTUP_ENV" ]; then
|
||||
# shellcheck disable=SC1090
|
||||
. "$RUSTUP_ENV"
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_uv() {
|
||||
if command -v uv >/dev/null 2>&1; then
|
||||
return
|
||||
fi
|
||||
step "uv (Python package manager) not found, installing"
|
||||
run sh -c 'curl -fsSL https://astral.sh/uv/install.sh | sh'
|
||||
if [ -r "$HOME/.local/bin/env" ]; then
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
. "$HOME/.local/bin/env"
|
||||
fi
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
export PATH
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Install / uninstall
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
release_asset_url() {
|
||||
# Prints a matching release asset URL for this distro family, or nothing.
|
||||
if ! command -v curl >/dev/null 2>&1; then
|
||||
return
|
||||
fi
|
||||
case "$DISTRO_FAMILY" in
|
||||
arch) want="*.pkg.tar.zst" ;;
|
||||
debian) want="*.deb" ;;
|
||||
*) return ;;
|
||||
esac
|
||||
latest_json="$(curl -fsSL "$REPO_API/releases/latest" 2>/dev/null || true)"
|
||||
[ -n "$latest_json" ] || return
|
||||
printf '%s' "$latest_json" | grep -o '"browser_download_url":"[^"]*"' \
|
||||
| sed 's/"browser_download_url":"//; s/"$//' \
|
||||
| while IFS= read -r url; do
|
||||
# shellcheck disable=SC2254
|
||||
case "$url" in
|
||||
$want) printf '%s\n' "$url"; return ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
install_native_package() {
|
||||
asset_url="$1"
|
||||
asset_file="/tmp/$(basename "$asset_url")"
|
||||
step "Downloading release asset: $asset_url"
|
||||
run curl -fsSL -o "$asset_file" "$asset_url"
|
||||
case "$DISTRO_FAMILY" in
|
||||
arch) run_sudo pacman -U --noconfirm "$asset_file" ;;
|
||||
debian) run_sudo apt-get install -y "$asset_file" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
build_from_source() {
|
||||
step "No usable release package found, building from source"
|
||||
ensure_rust
|
||||
if [ -d "$SRC_DIR/.git" ]; then
|
||||
run git -C "$SRC_DIR" fetch --tags
|
||||
run git -C "$SRC_DIR" checkout main
|
||||
run git -C "$SRC_DIR" pull --ff-only
|
||||
else
|
||||
run mkdir -p "$(dirname "$SRC_DIR")"
|
||||
run git clone "$REPO_GIT" "$SRC_DIR"
|
||||
fi
|
||||
run sh -c "cd '$SRC_DIR' && cargo build --release -p summit -p summit-gui"
|
||||
run_sudo install -Dm755 "$SRC_DIR/target/release/summit" "$BIN_DIR/summit"
|
||||
run_sudo install -Dm755 "$SRC_DIR/target/release/summit-gui" "$BIN_DIR/summit-gui"
|
||||
run_sudo mkdir -p "$SHARE_DIR/engine"
|
||||
run_sudo cp -r "$SRC_DIR/engine/." "$SHARE_DIR/engine/"
|
||||
}
|
||||
|
||||
setup_engine_venv() {
|
||||
step "Setting up the engine's Python environment (uv, Python 3.12)"
|
||||
ensure_uv
|
||||
engine_dir="$SHARE_DIR/engine"
|
||||
if [ ! -d "$engine_dir" ]; then
|
||||
engine_dir="$SRC_DIR/engine"
|
||||
fi
|
||||
if [ ! -d "$engine_dir" ]; then
|
||||
log " engine sources not found, skipping venv setup"
|
||||
return
|
||||
fi
|
||||
run sh -c "cd '$engine_dir' && uv venv --python 3.12 .venv"
|
||||
run sh -c "cd '$engine_dir' && uv pip install --python .venv -r requirements.txt"
|
||||
if [ "$GPU_VENDOR" = "nvidia" ]; then
|
||||
step "NVIDIA GPU detected: installing CUDA 12.8 torch build"
|
||||
run sh -c "cd '$engine_dir' && uv pip install --python .venv torch --index-url https://download.pytorch.org/whl/cu128"
|
||||
else
|
||||
log " no NVIDIA GPU detected, skipping CUDA torch (engine will run CPU-only or be unavailable)"
|
||||
fi
|
||||
}
|
||||
|
||||
do_install() {
|
||||
step "Plan"
|
||||
log " distro family : $DISTRO_FAMILY (ID=$DISTRO_ID)"
|
||||
log " GPU vendor : $GPU_VENDOR"
|
||||
log " session type : $SESSION_TYPE"
|
||||
log " will install : summit, summit-gui into $BIN_DIR"
|
||||
log " engine : $SHARE_DIR/engine with its own venv"
|
||||
if [ "$DRY_RUN" -eq 1 ]; then
|
||||
log " (--dry-run: no changes will be made)"
|
||||
fi
|
||||
|
||||
if [ "$ASSUME_YES" -eq 0 ] && [ "$DRY_RUN" -eq 0 ]; then
|
||||
printf '\nProceed? [y/N] '
|
||||
read -r reply
|
||||
case "$reply" in
|
||||
y|Y|yes|YES) ;;
|
||||
*) die "aborted" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
install_dependencies
|
||||
|
||||
asset_url="$(release_asset_url || true)"
|
||||
if [ -n "$asset_url" ]; then
|
||||
install_native_package "$asset_url"
|
||||
else
|
||||
build_from_source
|
||||
fi
|
||||
|
||||
setup_engine_venv
|
||||
|
||||
step "Done"
|
||||
log " summit -> $BIN_DIR/summit"
|
||||
log " summit-gui -> $BIN_DIR/summit-gui"
|
||||
log " engine -> $SHARE_DIR/engine (venv at $SHARE_DIR/engine/.venv)"
|
||||
}
|
||||
|
||||
do_uninstall() {
|
||||
step "Uninstalling Summit"
|
||||
run_sudo rm -f "$BIN_DIR/summit" "$BIN_DIR/summit-gui"
|
||||
run_sudo rm -rf "$SHARE_DIR"
|
||||
log "Left in place: $SRC_DIR (build cache), ~/.config/summit, ~/.local/share/summit (your data)"
|
||||
}
|
||||
|
||||
main() {
|
||||
detect_distro
|
||||
detect_gpu
|
||||
detect_session
|
||||
|
||||
if [ "$UNINSTALL" -eq 1 ]; then
|
||||
do_uninstall
|
||||
else
|
||||
do_install
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
# Build a Summit AppImage. Untested here: no network access to download
|
||||
# linuxdeploy/appimagetool in this environment. Needs linuxdeploy and
|
||||
# appimagetool on PATH (https://github.com/linuxdeploy/linuxdeploy,
|
||||
# https://github.com/AppImage/appimagetool), or set LINUXDEPLOY /
|
||||
# APPIMAGETOOL to their paths.
|
||||
#
|
||||
# Usage: packaging/appimage/build.sh [output-dir]
|
||||
#
|
||||
# The engine's Python venv is not bundled (it is GPU-specific and far too
|
||||
# large for an AppImage); summit-gui still runs, but `summit enhance` needs
|
||||
# install.sh's venv setup done separately.
|
||||
|
||||
set -eu
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
OUT_DIR="${1:-$REPO_ROOT/target/appimage}"
|
||||
LINUXDEPLOY="${LINUXDEPLOY:-linuxdeploy}"
|
||||
APPIMAGETOOL="${APPIMAGETOOL:-appimagetool}"
|
||||
APPDIR="$REPO_ROOT/target/appimage/Summit.AppDir"
|
||||
|
||||
command -v "$LINUXDEPLOY" >/dev/null 2>&1 || { echo "linuxdeploy not found, set LINUXDEPLOY=/path/to/it" >&2; exit 1; }
|
||||
command -v "$APPIMAGETOOL" >/dev/null 2>&1 || { echo "appimagetool not found, set APPIMAGETOOL=/path/to/it" >&2; exit 1; }
|
||||
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
if [ ! -x target/release/summit-gui ]; then
|
||||
echo "building release binaries..." >&2
|
||||
cargo build --release -p summit -p summit-gui
|
||||
fi
|
||||
|
||||
rm -rf "$APPDIR"
|
||||
mkdir -p "$APPDIR/usr/bin" "$APPDIR/usr/share/summit/engine"
|
||||
cp target/release/summit "$APPDIR/usr/bin/"
|
||||
cp target/release/summit-gui "$APPDIR/usr/bin/"
|
||||
cp -r engine/. "$APPDIR/usr/share/summit/engine/"
|
||||
find "$APPDIR/usr/share/summit/engine" -name '__pycache__' -exec rm -rf {} + 2>/dev/null || true
|
||||
|
||||
mkdir -p "$OUT_DIR"
|
||||
"$LINUXDEPLOY" \
|
||||
--appdir "$APPDIR" \
|
||||
--executable "$APPDIR/usr/bin/summit-gui" \
|
||||
--desktop-file packaging/summit.desktop \
|
||||
--icon-file packaging/icons/summit.png \
|
||||
--output appimage
|
||||
|
||||
mv ./Summit*.AppImage "$OUT_DIR/" 2>/dev/null || true
|
||||
echo "built AppImage in: $OUT_DIR"
|
||||
@@ -0,0 +1,41 @@
|
||||
# Maintainer: Alex <[email protected]>
|
||||
pkgname=summit
|
||||
pkgver=0.0.1
|
||||
pkgrel=1
|
||||
pkgdesc="One launcher for every game and app on Linux, with AI upscaling and frame generation"
|
||||
arch=('x86_64')
|
||||
url="https://git.molberg.cloud/alex/summit"
|
||||
license=('MIT')
|
||||
depends=('gcc-libs' 'openssl')
|
||||
makedepends=('cargo' 'git')
|
||||
optdepends=(
|
||||
'uv: set up the AI engine'"'"'s Python environment'
|
||||
'python>=3.12: run the AI engine'
|
||||
)
|
||||
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
|
||||
sha256sums=('SKIP')
|
||||
|
||||
prepare() {
|
||||
cd "$pkgname-$pkgver"
|
||||
cargo fetch --locked
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "$pkgname-$pkgver"
|
||||
cargo build --frozen --release -p summit -p summit-gui
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$pkgname-$pkgver"
|
||||
|
||||
install -Dm755 target/release/summit "$pkgdir/usr/bin/summit"
|
||||
install -Dm755 target/release/summit-gui "$pkgdir/usr/bin/summit-gui"
|
||||
|
||||
install -d "$pkgdir/usr/share/summit/engine"
|
||||
cp -r engine/. "$pkgdir/usr/share/summit/engine/"
|
||||
find "$pkgdir/usr/share/summit/engine" -name '__pycache__' -exec rm -rf {} +
|
||||
|
||||
install -Dm644 packaging/summit.desktop "$pkgdir/usr/share/applications/summit.desktop"
|
||||
install -Dm644 packaging/icons/summit.png "$pkgdir/usr/share/icons/hicolor/64x64/apps/summit.png"
|
||||
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
||||
}
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
# Build a .deb for Summit using a plain debian-package staging tree (no
|
||||
# cargo-deb required, just cargo, dpkg-deb and fakeroot/root).
|
||||
#
|
||||
# Usage: packaging/deb/build.sh [output-dir]
|
||||
#
|
||||
# Must be run from the repository root, after `cargo build --release`
|
||||
# has produced target/release/summit and target/release/summit-gui.
|
||||
|
||||
set -eu
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
OUT_DIR="${1:-$REPO_ROOT/target/debian}"
|
||||
VERSION="$(grep -m1 '^version' "$REPO_ROOT/Cargo.toml" | sed -E 's/.*"(.*)".*/\1/')"
|
||||
STAGE="$(mktemp -d)"
|
||||
trap 'rm -rf "$STAGE"' EXIT
|
||||
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
if [ ! -x target/release/summit ] || [ ! -x target/release/summit-gui ]; then
|
||||
echo "building release binaries..." >&2
|
||||
cargo build --release -p summit -p summit-gui
|
||||
fi
|
||||
|
||||
chmod 755 "$STAGE"
|
||||
mkdir -p "$STAGE/DEBIAN"
|
||||
sed "s/^Version:.*/Version: $VERSION/" packaging/deb/control > "$STAGE/DEBIAN/control"
|
||||
|
||||
install -Dm755 target/release/summit "$STAGE/usr/bin/summit"
|
||||
install -Dm755 target/release/summit-gui "$STAGE/usr/bin/summit-gui"
|
||||
|
||||
install -d "$STAGE/usr/share/summit/engine"
|
||||
cp -r engine/. "$STAGE/usr/share/summit/engine/"
|
||||
find "$STAGE/usr/share/summit/engine" -name '__pycache__' -exec rm -rf {} + 2>/dev/null || true
|
||||
|
||||
install -Dm644 packaging/summit.desktop "$STAGE/usr/share/applications/summit.desktop"
|
||||
install -Dm644 packaging/icons/summit.png "$STAGE/usr/share/icons/hicolor/64x64/apps/summit.png"
|
||||
install -Dm644 LICENSE "$STAGE/usr/share/doc/summit/LICENSE"
|
||||
|
||||
mkdir -p "$OUT_DIR"
|
||||
OUT_FILE="$OUT_DIR/summit_${VERSION}_amd64.deb"
|
||||
dpkg-deb --build --root-owner-group "$STAGE" "$OUT_FILE"
|
||||
echo "built: $OUT_FILE"
|
||||
@@ -0,0 +1,14 @@
|
||||
Package: summit
|
||||
Version: 0.0.1
|
||||
Section: games
|
||||
Priority: optional
|
||||
Architecture: amd64
|
||||
Depends: libc6, libssl3
|
||||
Recommends: uv, python3 (>= 3.12)
|
||||
Maintainer: Alex <[email protected]>
|
||||
Description: One launcher for every game and app on Linux
|
||||
Summit is a Rust game launcher that scans Steam, Heroic and Lutris libraries
|
||||
and gives every title AI upscaling and frame generation. This package
|
||||
contains the summit CLI, the summit-gui launcher, and the engine's Python
|
||||
sources under /usr/share/summit/engine (its virtualenv is set up separately,
|
||||
see install.sh).
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
@@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Summit
|
||||
Comment=One launcher for every game and app on Linux, with AI upscaling and frame generation
|
||||
Exec=summit-gui
|
||||
Icon=summit
|
||||
Terminal=false
|
||||
Categories=Game;
|
||||
StartupNotify=true
|
||||
Reference in new issue
Block a user