remove 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. sudo systemctl disable ynh-vpnclient-checker.service
  34. ynh_systemctl stop ynh-vpnclient-checker.timer && sleep 1
  35. sudo systemctl disable ynh-vpnclient-checker.timer
  36. ynh_systemctl stop ynh-vpnclient
  37. sudo systemctl disable ynh-vpnclient
  38. sudo yunohost service remove ynh-vpnclient
  39. sudo rm -f /etc/systemd/system/ynh-vpnclient* /usr/local/bin/ynh-vpnclient*
  40. sudo rm -f /tmp/.ynh-vpnclient-*
  41. # Remove confs
  42. sudo rm -f /etc/openvpn/client.conf{.tpl,.tpl.restore,}
  43. sudo rm -f /etc/nginx/conf.d/${domain}.d/${app}.conf
  44. sudo rm -f /etc/php5/fpm/pool.d/${app}.conf
  45. sudo rm -f /etc/yunohost/hooks.d/90-vpnclient.tpl
  46. sudo rm -f /etc/systemd/system/openvpn@.service
  47. # Remove certificates
  48. sudo rm -rf /etc/openvpn/keys/
  49. # Remove packages
  50. ynh_remove_app_dependencies
  51. # Restart services
  52. sudo systemctl restart php5-fpm
  53. sudo systemctl reload nginx
  54. # Remove sources
  55. sudo rm -rf /var/www/${app}/
  56. # Removed system user
  57. ynh_system_user_delete ${app}