add license
[0tDNS.git] / uninstall.sh
blob3bebfbbd0567d39e4f28da099be562d7b2c4d156
1 #!/bin/sh
3 # https://stackoverflow.com/questions/2990414/echo-that-outputs-to-stderr
4 errcho(){ >&2 echo "$@"; }
6 # run as root, obviously
7 if [ `id -u` != 0 ]; then
8 errcho "This script needs to be run as root"
9 exit 1
12 # revert what was done in setup.sh
13 userdel 0tdns
15 # remove our crontab entry marked with '<AUTO_GENERATED_0TDNS_ENTRY>'
16 # we also remove the 'DO NOT EDIT' header, as in setup.sh
17 crontab -l 2> /dev/null |
18 grep -vE '^# DO NOT EDIT THIS FILE|^# \(- installed on .*\)|^# \(Cron version .*\)' |
19 grep -v '<AUTO_GENERATED_0TDNS_ENTRY>' | crontab
21 # if told to - also revert what was done in install.sh
22 if [ "x$1" = "x--delete-files" ]; then
23 rm -r /var/lib/0tdns/
24 rm -r /etc/netns/0tdns*
25 rm /usr/sbin/hourly.py
26 rm /usr/sbin/check_if_done.py
27 rm /usr/bin/send_emails.py
28 rm -r /etc/0tdns
29 rm /usr/lib/python3/dist-packages/ztdnslib.py