remove 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/bash
  2. source _common.sh
  3. source /usr/share/yunohost/helpers
  4. #=================================================
  5. # STOP AND REMOVE SERVICES
  6. #=================================================
  7. ynh_print_info "Stopping and removing services"
  8. systemctl stop $service_checker_name.timer && sleep 1
  9. systemctl disable $service_checker_name.timer --quiet
  10. systemctl stop $service_checker_name
  11. systemctl disable $service_checker_name --quiet
  12. if ynh_exec_warn_less yunohost service status $service_name >/dev/null; then
  13. yunohost service stop $service_name
  14. yunohost service disable $service_name --quiet
  15. yunohost service remove $service_name
  16. fi
  17. for FILE in $(ls /etc/systemd/system/$service_name* /usr/local/bin/ynh-vpnclient* /tmp/.ynh-vpnclient-*); do
  18. ynh_secure_remove "$FILE"
  19. done
  20. #=================================================
  21. # SPECIFIC REMOVE
  22. #================================================
  23. ynh_print_info "Removing openvpn configuration"
  24. # Remove openvpn configurations
  25. ynh_secure_remove /etc/openvpn/client.conf
  26. ynh_secure_remove /etc/openvpn/client.cube
  27. ynh_secure_remove /etc/openvpn/client.ovpn
  28. # Remove openvpn script
  29. ynh_secure_remove /etc/openvpn/scripts/run-parts.sh
  30. for FILE in $(ls /etc/openvpn/scripts/route-up.d/*-vpnclient-* /etc/openvpn/scripts/route-down.d/*-vpnclient-*); do
  31. ynh_secure_remove "$FILE"
  32. done
  33. # Remove openvpn service
  34. ynh_secure_remove /etc/systemd/system/openvpn@.service.d/override.conf
  35. # Remove openvpn certificates
  36. ynh_secure_remove /etc/openvpn/keys
  37. # Reload systemd configuration
  38. systemctl daemon-reload
  39. # Make sure to reload the firewall now that the post_iptables_rules ain't there anymore
  40. ynh_print_info "Reloading firewall"
  41. yunohost firewall reload
  42. #=================================================
  43. # END OF SCRIPT
  44. #=================================================
  45. ynh_print_info "Removal of $app completed"