This repository has no description
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354#!/usr/bin/env bash# Linux packaging: build the release binary and produce# target/package/nova-<version>-linux-<arch>.tar.gz# containing the binary, the .desktop entry, and the icon, plus an install.sh# that drops them into ~/.local (XDG) paths.## Usage: scripts/package-linux.sh# Env: PROFILE=debug for a fast unoptimized package (CI smoke); default release.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"command -v cargo >/dev/null 2>&1 || PATH="$HOME/.cargo/bin:$PATH"PROFILE="${PROFILE:-release}"ARCH="$(uname -m)"VERSION="$(grep -m1 '^version' "$ROOT/Cargo.toml" | sed 's/.*"\(.*\)".*/\1/')"OUT_DIR="$ROOT/target/package"STAGE="$OUT_DIR/nova-$VERSION-linux-$ARCH"TARBALL="$STAGE.tar.gz"
cd "$ROOT"if [[ "$PROFILE" == "release" ]]; then cargo build --release -p nova BIN="$ROOT/target/release/nova"else cargo build -p nova BIN="$ROOT/target/debug/nova"fi
rm -rf "$STAGE" "$TARBALL"mkdir -p "$STAGE"install -m 755 "$BIN" "$STAGE/nova"install -m 644 "$ROOT/dist/nova.desktop" "$STAGE/nova.desktop"install -m 644 "$ROOT/dist/nova.png" "$STAGE/nova.png"
cat >"$STAGE/install.sh" <<'INSTALL'#!/usr/bin/env bash# Install Nova into ~/.local (no root needed).set -euo pipefailHERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"install -Dm755 "$HERE/nova" "$HOME/.local/bin/nova"install -Dm644 "$HERE/nova.desktop" "$HOME/.local/share/applications/nova.desktop"install -Dm644 "$HERE/nova.png" "$HOME/.local/share/icons/hicolor/1024x1024/apps/nova.png"command -v update-desktop-database >/dev/null 2>&1 \ && update-desktop-database "$HOME/.local/share/applications" || trueecho "Installed. Make sure ~/.local/bin is on your PATH."INSTALLchmod 755 "$STAGE/install.sh"
tar -czf "$TARBALL" -C "$OUT_DIR" "$(basename "$STAGE")"rm -rf "$STAGE"echo "packaged: $TARBALL"tar -tzf "$TARBALL"