#!/usr/bin/env bash # # Remove VoxIP Kiosk OS. # # sudo ./uninstall.sh # remove programs and services, keep configuration # sudo ./uninstall.sh --purge # also remove configuration, state, logs and users # # Installed Debian packages (Chromium, Xorg, Flask, …) are left in place; remove # them with apt if they are no longer needed. set -euo pipefail PURGE=0 [[ ${1:-} == "--purge" ]] && PURGE=1 [[ ${1:-} == "-h" || ${1:-} == "--help" ]] && { sed -n '3,10p' "$0" | sed 's/^# \{0,1\}//'; exit 0; } [[ $EUID -eq 0 ]] || { echo "Voer dit script uit met sudo." >&2; exit 1; } UNITS=(voxip-kiosk-healthcheck.timer voxip-kiosk-healthcheck.service voxip-kiosk-agent.service voxip-kiosk-browser.service voxip-kiosk-x.service voxip-kiosk-manager.service voxip-network-guard.service voxip-boot-import.service) PREVIOUS_TARGET="$(cat /var/lib/voxip-kiosk/previous-default-target 2>/dev/null || true)" mapfile -t DISABLED_DMS < <(cat /var/lib/voxip-kiosk/disabled-display-managers 2>/dev/null) echo "==> Services stoppen en verwijderen" systemctl stop voxip-network-rollback.timer 2>/dev/null || true for unit in "${UNITS[@]}"; do systemctl disable --now "$unit" 2>/dev/null || true rm -f "/etc/systemd/system/$unit" done systemctl daemon-reload echo "==> Bestanden verwijderen" rm -rf /usr/lib/voxip-kiosk /usr/share/voxip-kiosk /usr/share/doc/voxip-kiosk rm -f /usr/local/sbin/voxip-kiosk-ctl rm -f /etc/sudoers.d/voxip-kiosk rm -f /etc/systemd/journald.conf.d/voxip-kiosk.conf /etc/systemd/system.conf.d/voxip-watchdog.conf rm -f /etc/logrotate.d/voxip-kiosk /etc/avahi/services/voxip-kiosk.service rm -f /etc/chromium/policies/managed/voxip-kiosk.json /etc/chromium-browser/policies/managed/voxip-kiosk.json rm -f /etc/systemd/zram-generator.conf rm -f /etc/ssh/sshd_config.d/voxip-kiosk.conf if [[ -f /etc/X11/Xwrapper.config.voxip-orig ]]; then mv /etc/X11/Xwrapper.config.voxip-orig /etc/X11/Xwrapper.config else rm -f /etc/X11/Xwrapper.config fi if [[ -f /etc/systemd/system/display-kiosk.service.voxip-disabled ]]; then echo " (de eerdere InfoFlow-kioskservice staat nog als display-kiosk.service.voxip-disabled)" fi if [[ $PURGE -eq 1 ]]; then echo "==> Configuratie, status, logs en gebruikers verwijderen" rm -rf /etc/voxip-kiosk /var/lib/voxip-kiosk /var/lib/voxip-kiosk-network /var/lib/voxip-kiosk-browser /var/log/voxip-kiosk rm -f /etc/NetworkManager/system-connections/voxip-eth0.nmconnection /etc/NetworkManager/system-connections/voxip-wlan0.nmconnection nmcli connection reload 2>/dev/null || true userdel -r kiosk 2>/dev/null || true userdel voxip 2>/dev/null || true groupdel kiosk 2>/dev/null || true groupdel voxip 2>/dev/null || true else echo " Configuratie bewaard in /etc/voxip-kiosk (verwijderen met --purge)." echo " VoxIP-netwerkprofielen (voxip-eth0/voxip-wlan0) blijven actief." fi if [[ -n $PREVIOUS_TARGET ]]; then systemctl set-default "$PREVIOUS_TARGET" >/dev/null 2>&1 || true; fi for dm in "${DISABLED_DMS[@]}"; do systemctl enable "$dm" >/dev/null 2>&1 || true; done echo "==> VoxIP Kiosk OS is verwijderd. Herstart de Raspberry Pi om de kiosk te stoppen."