This commit is contained in:
Linrador 2026-06-23 20:27:09 +02:00
parent bf4e1f19e9
commit df52f94868
4 changed files with 61 additions and 3 deletions

View File

@ -22,6 +22,7 @@ DESCRIPTION_LONG="${DEB_DESCRIPTION_LONG:-${DESCRIPTION_LONG:-}}"
OUT_DIR="$SCRIPT_DIR/dist" OUT_DIR="$SCRIPT_DIR/dist"
BIN_PATH="$OUT_DIR/nsfwapp-linux-amd64" BIN_PATH="$OUT_DIR/nsfwapp-linux-amd64"
OUT_FILE="$OUT_DIR/${PACKAGE_NAME}_${ARCH}.deb" OUT_FILE="$OUT_DIR/${PACKAGE_NAME}_${ARCH}.deb"
ML_REQUIREMENTS_PATH="$SCRIPT_DIR/ml/requirements-ml.txt"
CLEAN_BUILD_DIR=0 CLEAN_BUILD_DIR=0
if [ -n "${DEB_BUILD_DIR:-}" ]; then if [ -n "${DEB_BUILD_DIR:-}" ]; then
@ -58,6 +59,7 @@ fail() {
[ -n "$DESCRIPTION_LONG" ] || fail "DESCRIPTION_LONG fehlt im Build-Manifest." [ -n "$DESCRIPTION_LONG" ] || fail "DESCRIPTION_LONG fehlt im Build-Manifest."
command -v dpkg-deb >/dev/null 2>&1 || fail "dpkg-deb fehlt. Installiere es mit: sudo apt install -y dpkg-dev" command -v dpkg-deb >/dev/null 2>&1 || fail "dpkg-deb fehlt. Installiere es mit: sudo apt install -y dpkg-dev"
[ -f "$ML_REQUIREMENTS_PATH" ] || fail "ML-Requirements nicht gefunden: $ML_REQUIREMENTS_PATH"
mkdir -p "$OUT_DIR" mkdir -p "$OUT_DIR"
@ -88,6 +90,7 @@ mkdir -p \
chmod 0755 "$PKG_ROOT" "$PKG_ROOT/DEBIAN" chmod 0755 "$PKG_ROOT" "$PKG_ROOT/DEBIAN"
install -m 0755 "$BIN_PATH" "$PKG_ROOT/opt/nsfwapp/nsfwapp" install -m 0755 "$BIN_PATH" "$PKG_ROOT/opt/nsfwapp/nsfwapp"
install -m 0644 "$ML_REQUIREMENTS_PATH" "$PKG_ROOT/opt/nsfwapp/requirements-ml.txt"
if [ -f "$SCRIPT_DIR/assets/img/tray.ico" ]; then if [ -f "$SCRIPT_DIR/assets/img/tray.ico" ]; then
install -m 0644 "$SCRIPT_DIR/assets/img/tray.ico" "$PKG_ROOT/usr/share/pixmaps/nsfwapp.ico" install -m 0644 "$SCRIPT_DIR/assets/img/tray.ico" "$PKG_ROOT/usr/share/pixmaps/nsfwapp.ico"
fi fi
@ -109,6 +112,59 @@ if [ ! -f "$runtime_bin" ] || ! cmp -s "$install_dir/nsfwapp" "$runtime_bin"; th
mv "$tmp" "$runtime_bin" mv "$tmp" "$runtime_bin"
fi fi
setup_ml_python() {
if [ "${NSFWAPP_SKIP_ML_SETUP:-0}" = "1" ]; then
return 0
fi
if [ -n "${AI_SERVER_PYTHON:-}" ]; then
return 0
fi
requirements_file="$install_dir/requirements-ml.txt"
if [ ! -f "$requirements_file" ]; then
return 0
fi
venv_dir="${NSFWAPP_ML_VENV:-$app_dir/ml-venv}"
venv_python="$venv_dir/bin/python"
requirements_marker="$venv_dir/.requirements-ml.txt"
setup_log="$app_dir/ml-setup.log"
if [ ! -x "$venv_python" ]; then
echo "Erstelle Python-ML-Umgebung: $venv_dir" >&2
if ! python3 -m venv "$venv_dir" >>"$setup_log" 2>&1; then
return 1
fi
fi
if [ ! -f "$requirements_marker" ] || ! cmp -s "$requirements_file" "$requirements_marker"; then
echo "Installiere Python-ML-Pakete. Details: $setup_log" >&2
if command -v notify-send >/dev/null 2>&1; then
notify-send "NSFW App" "ML-Python-Pakete werden installiert. Das kann beim ersten Start dauern." || true
fi
if ! "$venv_python" -m pip install --upgrade pip >>"$setup_log" 2>&1; then
return 1
fi
if ! "$venv_python" -m pip install -r "$requirements_file" >>"$setup_log" 2>&1; then
return 1
fi
if ! cp "$requirements_file" "$requirements_marker"; then
return 1
fi
fi
AI_SERVER_PYTHON="$venv_python"
export AI_SERVER_PYTHON
return 0
}
if ! setup_ml_python; then
echo "Warnung: ML-Python-Umgebung konnte nicht vorbereitet werden. Details: $app_dir/ml-setup.log" >&2
if command -v notify-send >/dev/null 2>&1; then
notify-send "NSFW App" "ML-Python-Umgebung konnte nicht vorbereitet werden. Siehe ml-setup.log." || true
fi
fi
cd "$app_dir" cd "$app_dir"
exec "$runtime_bin" "$@" exec "$runtime_bin" "$@"
EOF EOF
@ -262,7 +318,9 @@ User-Daten:
Wichtige Laufzeitprogramme: Wichtige Laufzeitprogramme:
ffmpeg/ffprobe muessen fuer Recording, Teaser, Analyse und Videofunktionen verfuegbar sein. ffmpeg/ffprobe muessen fuer Recording, Teaser, Analyse und Videofunktionen verfuegbar sein.
SQLite ist die Standard-Datenbank. pg_dump/pg_restore werden nur fuer Postgres-Backup und Restore benoetigt. SQLite ist die Standard-Datenbank. pg_dump/pg_restore werden nur fuer Postgres-Backup und Restore benoetigt.
Der AI-Server braucht Python und die benoetigten Python-Pakete deiner ML-Umgebung. Der Launcher erstellt beim ersten Start automatisch ${NSFWAPP_HOME:-$HOME/nsfwapp}/ml-venv
und installiert die mitgelieferte requirements-ml.txt. Details stehen in ml-setup.log.
Setze AI_SERVER_PYTHON, wenn du eine eigene Python-Umgebung verwenden willst.
EOF EOF
cat >"$PKG_ROOT/DEBIAN/control" <<EOF cat >"$PKG_ROOT/DEBIAN/control" <<EOF
@ -272,7 +330,7 @@ Section: $SECTION
Priority: $PRIORITY Priority: $PRIORITY
Architecture: $ARCH Architecture: $ARCH
Maintainer: $MAINTAINER Maintainer: $MAINTAINER
Depends: ca-certificates, ffmpeg, python3, xdg-utils, libnotify-bin, procps Depends: ca-certificates, ffmpeg, python3, python3-venv, xdg-utils, libnotify-bin, procps
Description: $DESCRIPTION_SHORT Description: $DESCRIPTION_SHORT
$DESCRIPTION_LONG $DESCRIPTION_LONG
EOF EOF

View File

@ -1,7 +1,7 @@
# Build and Debian package metadata. # Build and Debian package metadata.
PACKAGE_NAME="nsfwapp" PACKAGE_NAME="nsfwapp"
APP_TITLE="NSFW App" APP_TITLE="NSFW App"
VERSION="1.2.0" VERSION="1.2.1"
ARCH="amd64" ARCH="amd64"
SECTION="video" SECTION="video"
PRIORITY="optional" PRIORITY="optional"

Binary file not shown.

Binary file not shown.