Compare commits

...
1 Commits
Author SHA1 Message Date
quoije f367bbe298 Clean /usr/bin install: contents dir 'lib' + install.sh
build / Windows x64 (Wine) (push) Successful in 20m38s
build / Linux x86_64 (push) Successful in 13m11s
2026-09-13 21:47:32 -04:00
3 changed files with 88 additions and 2 deletions
+5 -1
View File
@@ -25,7 +25,11 @@ jobs:
run: pyinstaller --clean --noconfirm psp-preserve.spec run: pyinstaller --clean --noconfirm psp-preserve.spec
- name: Package tarball - name: Package tarball
run: tar -czf psp-preserve-linux-x86_64.tar.gz -C dist psp-preserve run: |
cp packaging/install.sh dist/psp-preserve/
cp packaging/psp-preserve.desktop dist/psp-preserve/
cp img/app-icon.png dist/psp-preserve/
tar -czf psp-preserve-linux-x86_64.tar.gz -C dist psp-preserve
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
+81
View File
@@ -0,0 +1,81 @@
#!/bin/sh
# Install the PSP Preservation Tool to a system prefix.
#
# FHS-friendly layout:
# $PREFIX/bin/psp-preserve symlink -> payload binary
# $PREFIX/lib/psp-preserve/ app payload (binary + lib/)
# $PREFIX/share/applications/ desktop entry
# $PREFIX/share/icons/hicolor/256x256/apps/ app icon
#
# The PyInstaller onedir build keeps the executable and its `lib/` contents
# directory side by side, so both live under $PREFIX/lib/psp-preserve/ and a
# symlink exposes the binary at $PREFIX/bin/psp-preserve.
#
# Usage (run from inside the extracted tarball):
# sudo ./install.sh # install to /usr/local (default)
# sudo ./install.sh --prefix=/usr # install to /usr
# sudo ./install.sh --uninstall # remove from the default prefix
set -eu
PREFIX=/usr/local
MODE=install
for arg in "$@"; do
case "$arg" in
--prefix=*) PREFIX=${arg#--prefix=} ;;
--uninstall) MODE=uninstall ;;
*) echo "unknown argument: $arg" >&2; exit 2 ;;
esac
done
SRC_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
LIBDIR="$PREFIX/lib/psp-preserve"
BINDIR="$PREFIX/bin"
APPDIR="$PREFIX/share/applications"
ICONDIR="$PREFIX/share/icons/hicolor/256x256/apps"
APP_BIN="$LIBDIR/psp-preserve"
require_root() {
if [ "$(id -u)" -ne 0 ]; then
echo "run as root (e.g. sudo)" >&2
exit 1
fi
}
uninstall() {
rm -f "$BINDIR/psp-preserve"
rm -f "$APPDIR/psp-preserve.desktop"
rm -f "$ICONDIR/psp-preserve.png"
rm -rf "$LIBDIR"
echo "Uninstalled from $PREFIX"
}
if [ "$MODE" = uninstall ]; then
require_root
uninstall
exit 0
fi
require_root
# The tarball ships these next to this script.
for f in psp-preserve lib psp-preserve.desktop app-icon.png; do
if [ ! -e "$SRC_DIR/$f" ]; then
echo "missing $f (run install.sh from inside the extracted tarball)" >&2
exit 1
fi
done
mkdir -p "$LIBDIR" "$BINDIR" "$APPDIR" "$ICONDIR"
rm -rf "$LIBDIR"
mkdir -p "$LIBDIR"
cp -a "$SRC_DIR/psp-preserve" "$LIBDIR/psp-preserve"
cp -a "$SRC_DIR/lib" "$LIBDIR/lib"
install -m 0644 "$SRC_DIR/psp-preserve.desktop" "$APPDIR/psp-preserve.desktop"
install -m 0644 "$SRC_DIR/app-icon.png" "$ICONDIR/psp-preserve.png"
ln -sfn "$APP_BIN" "$BINDIR/psp-preserve"
echo "Installed to $PREFIX"
echo " binary: $BINDIR/psp-preserve -> $APP_BIN"
echo " payload: $LIBDIR"
echo " desktop: $APPDIR/psp-preserve.desktop"
+2 -1
View File
@@ -2,7 +2,7 @@
"""PyInstaller spec: build the PSP Preservation Tool (onedir). """PyInstaller spec: build the PSP Preservation Tool (onedir).
Bundles the read-only resources (DATs, PS1 loader, offline cover bundles, Bundles the read-only resources (DATs, PS1 loader, offline cover bundles,
icons) under ``_internal/`` next to the executable. User-writable data icons) under ``lib/`` next to the executable. User-writable data
(credentials, manual covers, PS1 templates, NPS cache, library DB, cover (credentials, manual covers, PS1 templates, NPS cache, library DB, cover
cache) lives in the OS state dir at runtime — see ``app/config.py``. cache) lives in the OS state dir at runtime — see ``app/config.py``.
@@ -63,4 +63,5 @@ coll = COLLECT(
strip=False, strip=False,
upx=False, upx=False,
name="psp-preserve", name="psp-preserve",
contents_directory="lib",
) )