rename ztdns_db_connectivity -> src/ztdnslib
[0tDNS.git] / uninstall.sh
blob5e8a0b88897e7b2418d684a1eff21dbd1f10d06d
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 -r /etc/0tdns
27 rm /usr/lib/python3/dist-packages/ztdnslib.py