Files
Geekwom-NASPi-Daemon/root/DEBIAN/postrm
Cantibra c174cfc645
All checks were successful
Geekwom NASPi Daemon / Geekwom NASPi Daemon (Bookworm) [arm64] (push) Successful in 10s
Inital Commit
2025-10-26 08:05:50 +01:00

32 lines
1.1 KiB
Bash

#!/usr/bin/sh
set -e
set -u
if [ -d '/run/systemd/system' ]; then
/usr/bin/systemctl --system daemon-reload > '/dev/null' 2>&1 || \
/usr/bin/true
fi
case "${1}" in
remove|purge)
if [ -x '/usr/bin/deb-systemd-helper' ]; then
/usr/bin/deb-systemd-helper purge 'geekworm-naspi-pwmd.service' > '/dev/null' 2>&1 || \
/usr/bin/true
/usr/bin/deb-systemd-helper unmask 'geekworm-naspi-pwmd.service' > '/dev/null' 2>&1 || \
/usr/bin/true
/usr/bin/deb-systemd-helper purge 'geekworm-naspi-button.service' > '/dev/null' 2>&1 || \
/usr/bin/true
/usr/bin/deb-systemd-helper unmask 'geekworm-naspi-button.service' > '/dev/null' 2>&1 || \
/usr/bin/true
fi
BOOT=$(/usr/bin/grep '/boot' '/etc/fstab' | /usr/bin/mawk '$1 !~ /^#/ && $2 ~ /^[/]/ {print $2}')
PATTERN="## pwm-2chan\n## Load the Pulse-Width Modulation driver.\n##\ndtoverlay=pwm-2chan"
/usr/bin/test -n "${BOOT}"
/usr/bin/sed --in-place "/## pwm-2chan/{
N;N;N
s/${PATTERN}//g}" "${BOOT}/config.txt"
/usr/bin/sed --in-place --expression=':a' --expression='/^\n*$/{$d;N;ba' --expression='}' "${BOOT}/config.txt"
;;
esac