remove 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/bash
  2. #=================================================
  3. # GENERIC START
  4. #=================================================
  5. # IMPORT GENERIC HELPERS
  6. #=================================================
  7. source _common.sh
  8. source /usr/share/yunohost/helpers
  9. #=================================================
  10. # STANDARD REMOVE
  11. #=================================================
  12. # REMOVE SERVICE INTEGRATION IN YUNOHOST
  13. #=================================================
  14. # Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
  15. ynh_script_progression --message="Removing $app service"
  16. yunohost service stop $service_name
  17. yunohost service remove $service_name
  18. ynh_remove_systemd_config --service=$service_name
  19. ynh_remove_systemd_config --service="hostapd@$app"
  20. #=================================================
  21. # REMOVE APP MAIN DIR
  22. #=================================================
  23. ynh_script_progression --message="Removing $app configurations..."
  24. ynh_secure_remove --file="/etc/openvpn/scripts/route-up.d/90-${service_name}"
  25. ynh_secure_remove --file="/etc/openvpn/scripts/route-down.d/90-${service_name}"
  26. ynh_secure_remove --file="/usr/local/bin/$service_name"
  27. for FILE in $(ls /tmp/.${service_name}-* 2>/dev/null); do
  28. ynh_secure_remove --file="$FILE"
  29. done
  30. # Remove confs
  31. ynh_secure_remove --file="/etc/dnsmasq.d/$app.conf"
  32. systemctl restart dnsmasq
  33. ynh_secure_remove --file="/etc/dnsmasq.$app/"
  34. ynh_secure_remove --file="/etc/hostapd/$app/"
  35. #=================================================
  36. # CLOSE A PORT
  37. #=================================================
  38. if [[ -z "$(other_hotspot_apps)" ]]; then
  39. if yunohost firewall list | grep -q "\- 547$"; then
  40. ynh_script_progression --message="Closing port 547"
  41. ynh_exec_warn_less yunohost firewall disallow TCP 547
  42. fi
  43. if yunohost firewall list | grep -q "\- 67$"; then
  44. ynh_script_progression --message="Closing port 67"
  45. ynh_exec_warn_less yunohost firewall disallow TCP 67
  46. fi
  47. fi