uninstall.sh 945 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. dotnetDir="/opt/dotnet"
  3. if [ -d "/etc/dns/config" ]
  4. then
  5. dnsDir="/etc/dns"
  6. else
  7. dnsDir="/opt/technitium/dns"
  8. fi
  9. echo ""
  10. echo "================================="
  11. echo "Technitium DNS Server Uninstaller"
  12. echo "================================="
  13. echo ""
  14. echo "Uninstalling Technitium DNS Server..."
  15. if [ -d $dnsDir ]
  16. then
  17. if [ "$(ps --no-headers -o comm 1 | tr -d '\n')" = "systemd" ]
  18. then
  19. sudo systemctl disable dns.service >/dev/null 2>&1
  20. sudo systemctl stop dns.service >/dev/null 2>&1
  21. rm /etc/systemd/system/dns.service >/dev/null 2>&1
  22. rm /etc/resolv.conf >/dev/null 2>&1
  23. echo "nameserver 8.8.8.8" >> /etc/resolv.conf
  24. echo "nameserver 1.1.1.1" >> /etc/resolv.conf
  25. fi
  26. rm -rf $dnsDir >/dev/null 2>&1
  27. if [ -d $dotnetDir ]
  28. then
  29. echo "Uninstalling .NET Runtime..."
  30. rm /usr/bin/dotnet >/dev/null 2>&1
  31. rm -rf $dotnetDir >/dev/null 2>&1
  32. fi
  33. fi
  34. echo ""
  35. echo "Thank you for using Technitium DNS Server!"