@@ -18,26 +18,27 @@ echo ""
1818echo " ================================="
1919echo " Technitium DNS Server Uninstaller"
2020echo " ================================="
21- echo " "
22- echo " Uninstalling Technitium DNS Server..."
2321
2422if [ -d $dnsDir ]
2523then
24+ echo " "
25+ echo " Uninstalling Technitium DNS Server..."
26+
27+ rm /etc/resolv.conf > /dev/null 2>&1
28+
29+ if [ -f " $dnsDir /resolv.conf.bak" ] || [ -L " $dnsDir /resolv.conf.bak" ]
30+ then
31+ cp -a $dnsDir /resolv.conf.bak /etc/resolv.conf > /dev/null 2>&1
32+ else
33+ printf " nameserver 8.8.8.8\nnameserver 1.1.1.1\n" > /etc/resolv.conf
34+ fi
35+
2636 if [ " $( ps --no-headers -o comm 1 | tr -d ' \n' ) " = " systemd" ]
2737 then
2838 systemctl disable dns.service > /dev/null 2>&1
2939 systemctl stop dns.service > /dev/null 2>&1
3040 rm /etc/systemd/system/dns.service > /dev/null 2>&1
3141
32- rm /etc/resolv.conf > /dev/null 2>&1
33-
34- if [ -f " $dnsDir /resolv.conf.bak" ] || [ -L " $dnsDir /resolv.conf.bak" ]
35- then
36- cp -a $dnsDir /resolv.conf.bak /etc/resolv.conf > /dev/null 2>&1
37- else
38- printf " nameserver 8.8.8.8\nnameserver 1.1.1.1\n" > /etc/resolv.conf
39- fi
40-
4142 if [ -f " /etc/NetworkManager/NetworkManager.conf" ]
4243 then
4344 currentVal=$( grep -F " dns=" /etc/NetworkManager/NetworkManager.conf)
5253 systemctl start systemd-resolved > /dev/null 2>&1
5354
5455 userdel -f $serviceUser > /dev/null 2>&1
55- fi
56+ elif [ -x " /sbin/rc-service" ]
57+ then
58+ rc-service dns stop > /dev/null 2>&1
59+ rc-update del dns > /dev/null 2>&1
60+ rm /etc/init.d/dns > /dev/null 2>&1
61+
62+ deluser $serviceUser > /dev/null 2>&1
63+ fi 2> /dev/null
5664
5765 rm -rf $dnsDir > /dev/null 2>&1
66+ fi
5867
59- if [ -d $dotnetDir ]
60- then
61- echo " "
62- printf " Do you want to uninstall .NET Runtime (Y/n): "
63- read -r answer0 < /dev/tty
64-
65- case " $answer0 " in
66- [Nn]* )
67- echo " .NET Runtime was not uninstalled."
68- ;;
69- * )
70- echo " Uninstalling .NET Runtime..."
71- rm /usr/bin/dotnet > /dev/null 2>&1
72- rm -rf $dotnetDir > /dev/null 2>&1
73- ;;
74- esac
75- fi
68+ if [ -d $dotnetDir ]
69+ then
70+ echo " "
71+ printf " Do you want to uninstall .NET Runtime (Y/n): "
72+ read -r answer0 < /dev/tty
73+
74+ case " $answer0 " in
75+ [Nn]* )
76+ echo " .NET Runtime was not uninstalled."
77+ ;;
78+ * )
79+ echo " Uninstalling .NET Runtime..."
80+ rm /usr/bin/dotnet > /dev/null 2>&1
81+ rm -rf $dotnetDir > /dev/null 2>&1
82+ ;;
83+ esac
84+ fi
7685
77- if [ -d " $dnsConfig " ]
78- then
79- echo " "
80- printf " Do you want to delete the '$dnsConfig ' folder which contains all of the DNS server config files? (y/N): "
81- read -r answer1 < /dev/tty
82-
83- case " $answer1 " in
84- [Yy]* )
85- rm -rf " $dnsConfig " > /dev/null 2>&1
86- echo " The '$dnsConfig ' config folder was deleted successfully."
87- ;;
88- * )
89- chown -R root:root " $dnsConfig " > /dev/null 2>&1
90- echo " The '$dnsConfig ' config folder was not deleted and it will be reused if you install the DNS server again."
91- ;;
92- esac
93- fi
86+ if [ -d " $dnsConfig " ]
87+ then
88+ echo " "
89+ printf " Do you want to delete the '$dnsConfig ' folder which contains all of the DNS server config files? (y/N): "
90+ read -r answer1 < /dev/tty
91+
92+ case " $answer1 " in
93+ [Yy]* )
94+ rm -rf " $dnsConfig " > /dev/null 2>&1
95+ echo " The '$dnsConfig ' config folder was deleted successfully."
96+ ;;
97+ * )
98+ chown -R root:root " $dnsConfig " > /dev/null 2>&1
99+ echo " The '$dnsConfig ' config folder was not deleted and it will be reused if you install the DNS server again."
100+ ;;
101+ esac
102+ fi
94103
95- if [ -d " $dnsLog " ]
96- then
97- echo " "
98- printf " Do you want to delete the '$dnsLog ' folder which contains all of the DNS server log files? (y/N): "
99- read -r answer2 < /dev/tty
100-
101- case " $answer2 " in
102- [Yy]* )
103- rm -rf " $dnsLog " > /dev/null 2>&1
104- echo " The '$dnsLog ' logs folder was deleted successfully."
105- ;;
106- * )
107- chown -R root:root " $dnsLog " > /dev/null 2>&1
108- echo " The '$dnsLog ' logs folder was not deleted."
109- ;;
110- esac
111- fi
104+ if [ -d " $dnsLog " ]
105+ then
106+ echo " "
107+ printf " Do you want to delete the '$dnsLog ' folder which contains all of the DNS server log files? (y/N): "
108+ read -r answer2 < /dev/tty
109+
110+ case " $answer2 " in
111+ [Yy]* )
112+ rm -rf " $dnsLog " > /dev/null 2>&1
113+ echo " The '$dnsLog ' logs folder was deleted successfully."
114+ ;;
115+ * )
116+ chown -R root:root " $dnsLog " > /dev/null 2>&1
117+ echo " The '$dnsLog ' logs folder was not deleted."
118+ ;;
119+ esac
112120fi
113121
114122echo " "
0 commit comments