remove 1.8 KB

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