added stop command

This commit is contained in:
Linrador 2026-06-23 12:24:33 +02:00
parent 5fc2d555ad
commit 368491d3c0

View File

@ -106,6 +106,54 @@ fi
EOF
chmod 0755 "$PKG_ROOT/usr/bin/nsfwapp-open"
cat >"$PKG_ROOT/usr/bin/nsfwapp-stop" <<'EOF'
#!/usr/bin/env sh
set -eu
data_home="${XDG_DATA_HOME:-$HOME/.local/share}"
runtime_bin="$data_home/nsfwapp/nsfwapp"
install_bin="/opt/nsfwapp/nsfwapp"
pids=""
if command -v pgrep >/dev/null 2>&1; then
for pattern in "$runtime_bin" "$install_bin"; do
found="$(pgrep -f "$pattern" 2>/dev/null || true)"
if [ -n "$found" ]; then
pids="$pids $found"
fi
done
fi
if [ -z "$(echo "$pids" | tr -d '[:space:]')" ]; then
if command -v notify-send >/dev/null 2>&1; then
notify-send "NSFW App" "Die Anwendung läuft nicht." || true
fi
exit 0
fi
for pid in $pids; do
kill -TERM "$pid" 2>/dev/null || true
done
sleep 1
still_running=0
for pid in $pids; do
if kill -0 "$pid" 2>/dev/null; then
still_running=1
fi
done
if command -v notify-send >/dev/null 2>&1; then
if [ "$still_running" = "1" ]; then
notify-send "NSFW App" "Beenden wurde angefordert." || true
else
notify-send "NSFW App" "Anwendung beendet." || true
fi
fi
EOF
chmod 0755 "$PKG_ROOT/usr/bin/nsfwapp-stop"
cat >"$PKG_ROOT/usr/share/applications/nsfwapp.desktop" <<EOF
[Desktop Entry]
Type=Application
@ -118,6 +166,19 @@ Categories=AudioVideo;Video;
StartupNotify=false
EOF
cat >"$PKG_ROOT/usr/share/applications/nsfwapp-stop.desktop" <<EOF
[Desktop Entry]
Type=Application
Name=$APP_TITLE beenden
Comment=Recorder Backend beenden
Exec=nsfwapp-stop
Icon=/usr/share/pixmaps/nsfwapp.ico
Terminal=false
Categories=AudioVideo;Video;
Keywords=stop;quit;exit;beenden;
StartupNotify=false
EOF
cat >"$PKG_ROOT/usr/share/doc/nsfwapp/README.Debian" <<'EOF'
NSFW App fuer Debian
====================
@ -125,8 +186,12 @@ NSFW App fuer Debian
Start:
nsfwapp
Beenden:
nsfwapp-stop
Desktop:
Der Launcher "NSFW App" startet das Backend und oeffnet https://localhost:9999.
Der Launcher "NSFW App beenden" beendet das Backend.
User-Daten:
Die installierte Binary liegt unter /opt/nsfwapp/nsfwapp.
@ -150,7 +215,7 @@ Section: video
Priority: optional
Architecture: $ARCH
Maintainer: Local Build <local@example.invalid>
Depends: ca-certificates, ffmpeg, python3, xdg-utils, libnotify-bin
Depends: ca-certificates, ffmpeg, python3, xdg-utils, libnotify-bin, procps
Description: NSFW recorder backend and web UI
Local Debian package for the NSFW recorder backend with embedded web UI and ML assets.
EOF