remove 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/bash
  2. # VPN Client app for YunoHost
  3. # Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
  4. # Contribute at https://github.com/labriqueinternet/vpnclient_ynh
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU Affero General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU Affero General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU Affero General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. #=================================================
  19. # GENERIC STARTING
  20. #=================================================
  21. # IMPORT GENERIC HELPERS
  22. #=================================================
  23. source _common.sh
  24. source /usr/share/yunohost/helpers
  25. #=================================================
  26. # LOAD SETTINGS
  27. #=================================================
  28. app=$YNH_APP_INSTANCE_NAME
  29. domain=$(ynh_app_setting_get $app domain)
  30. #=================================================
  31. # The End
  32. ynh_systemctl stop ynh-vpnclient-checker.service
  33. systemctl disable ynh-vpnclient-checker.service
  34. ynh_systemctl stop ynh-vpnclient-checker.timer && sleep 1
  35. systemctl disable ynh-vpnclient-checker.timer
  36. ynh_systemctl stop ynh-vpnclient
  37. systemctl disable ynh-vpnclient
  38. yunohost service remove ynh-vpnclient
  39. for FILE in $(ls /etc/systemd/system/ynh-vpnclient* /usr/local/bin/ynh-vpnclient* /tmp/.ynh-vpnclient-*)
  40. do
  41. ynh_secure_remove "$FILE"
  42. done
  43. # Remove confs
  44. ynh_secure_remove /etc/openvpn/client.conf
  45. ynh_secure_remove /etc/openvpn/client.conf.tpl
  46. ynh_secure_remove /etc/openvpn/client.conf.tpl.restore
  47. ynh_secure_remove /etc/nginx/conf.d/${domain}.d/${app}.conf
  48. ynh_secure_remove /etc/php5/fpm/pool.d/${app}.conf
  49. ynh_secure_remove /etc/yunohost/hooks.d/90-vpnclient.tpl
  50. ynh_secure_remove /etc/systemd/system/openvpn@.service
  51. # Remove certificates
  52. ynh_secure_remove /etc/openvpn/keys
  53. # Remove packages
  54. ynh_remove_app_dependencies
  55. # Remove sources
  56. ynh_secure_remove "/var/www/${app}"
  57. # Restart services
  58. # (this must happen before deleting the user, otherwise the user is
  59. # being used by one of the php pool process)
  60. systemctl restart php5-fpm
  61. systemctl reload nginx
  62. # Removed system user
  63. ynh_system_user_delete ${app}
  64. ynh_secure_remove "/etc/sudoers.d/${app}_ynh"