added stop command
This commit is contained in:
parent
5fc2d555ad
commit
368491d3c0
@ -106,6 +106,54 @@ fi
|
|||||||
EOF
|
EOF
|
||||||
chmod 0755 "$PKG_ROOT/usr/bin/nsfwapp-open"
|
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
|
cat >"$PKG_ROOT/usr/share/applications/nsfwapp.desktop" <<EOF
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Type=Application
|
Type=Application
|
||||||
@ -118,6 +166,19 @@ Categories=AudioVideo;Video;
|
|||||||
StartupNotify=false
|
StartupNotify=false
|
||||||
EOF
|
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'
|
cat >"$PKG_ROOT/usr/share/doc/nsfwapp/README.Debian" <<'EOF'
|
||||||
NSFW App fuer Debian
|
NSFW App fuer Debian
|
||||||
====================
|
====================
|
||||||
@ -125,8 +186,12 @@ NSFW App fuer Debian
|
|||||||
Start:
|
Start:
|
||||||
nsfwapp
|
nsfwapp
|
||||||
|
|
||||||
|
Beenden:
|
||||||
|
nsfwapp-stop
|
||||||
|
|
||||||
Desktop:
|
Desktop:
|
||||||
Der Launcher "NSFW App" startet das Backend und oeffnet https://localhost:9999.
|
Der Launcher "NSFW App" startet das Backend und oeffnet https://localhost:9999.
|
||||||
|
Der Launcher "NSFW App beenden" beendet das Backend.
|
||||||
|
|
||||||
User-Daten:
|
User-Daten:
|
||||||
Die installierte Binary liegt unter /opt/nsfwapp/nsfwapp.
|
Die installierte Binary liegt unter /opt/nsfwapp/nsfwapp.
|
||||||
@ -150,7 +215,7 @@ Section: video
|
|||||||
Priority: optional
|
Priority: optional
|
||||||
Architecture: $ARCH
|
Architecture: $ARCH
|
||||||
Maintainer: Local Build <local@example.invalid>
|
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
|
Description: NSFW recorder backend and web UI
|
||||||
Local Debian package for the NSFW recorder backend with embedded web UI and ML assets.
|
Local Debian package for the NSFW recorder backend with embedded web UI and ML assets.
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user