remove 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 remove $service_name
  14. fi
  15. for FILE in $(ls /etc/systemd/system/$service_name* /usr/local/bin/ynh-vpnclient* /tmp/.ynh-vpnclient-*); do
  16. ynh_secure_remove "$FILE"
  17. done
  18. #=================================================
  19. # SPECIFIC REMOVE
  20. #================================================
  21. ynh_print_info "Removing openvpn configuration"
  22. # Remove openvpn configurations
  23. ynh_secure_remove /etc/openvpn/client.conf
  24. ynh_secure_remove /etc/openvpn/client.cube
  25. ynh_secure_remove /etc/openvpn/client.ovpn
  26. # Remove openvpn script
  27. ynh_secure_remove /etc/openvpn/scripts/run-parts.sh
  28. for FILE in $(ls /etc/openvpn/scripts/route-up.d/*-vpnclient-* /etc/openvpn/scripts/route-down.d/*-vpnclient-*); do
  29. ynh_secure_remove "$FILE"
  30. done
  31. # Remove openvpn service
  32. ynh_secure_remove /etc/systemd/system/openvpn@.service.d/override.conf
  33. # Remove openvpn certificates
  34. ynh_secure_remove /etc/openvpn/keys
  35. # Reload systemd configuration
  36. systemctl daemon-reload
  37. # Make sure to reload the firewall now that the post_iptables_rules ain't there anymore
  38. ynh_print_info "Reloading firewall"
  39. yunohost firewall reload
  40. #=================================================
  41. # END OF SCRIPT
  42. #=================================================
  43. ynh_print_info "Removal of $app completed"