36 lines
1.0 KiB
Bash
36 lines
1.0 KiB
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
if [ "$(id -u)" -ne 0 ]; then
|
|
echo "run as root" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if command -v systemctl >/dev/null 2>&1 && [ -d /run/systemd/system ]; then
|
|
systemctl stop klipperanywhere-agent 2>/dev/null || true
|
|
systemctl disable klipperanywhere-agent 2>/dev/null || true
|
|
rm -f /etc/systemd/system/klipperanywhere-agent.service
|
|
systemctl daemon-reload
|
|
fi
|
|
|
|
if [ -x /etc/init.d/klipperanywhere-agent ]; then
|
|
/etc/init.d/klipperanywhere-agent stop 2>/dev/null || true
|
|
fi
|
|
rm -f /etc/init.d/klipperanywhere-agent
|
|
rm -f /etc/rcS.d/S99klipperanywhere-agent
|
|
rm -f /etc/rc.d/S99klipperanywhere-agent
|
|
|
|
if command -v rc-update >/dev/null 2>&1; then
|
|
rc-update del klipperanywhere-agent default 2>/dev/null || true
|
|
fi
|
|
if command -v update-rc.d >/dev/null 2>&1; then
|
|
update-rc.d -f klipperanywhere-agent remove 2>/dev/null || true
|
|
fi
|
|
if command -v chkconfig >/dev/null 2>&1; then
|
|
chkconfig --del klipperanywhere-agent 2>/dev/null || true
|
|
fi
|
|
|
|
rm -f /usr/local/bin/klipperanywhere-agent
|
|
|
|
echo "Left /etc/klipperanywhere/agent.json in place."
|