remove 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. # Retrieve arguments
  3. domain=$(sudo yunohost app setting vpnclient domain)
  4. # The End
  5. sudo yunohost service stop ynh-vpnclient
  6. sudo yunohost service remove ynh-vpnclient
  7. sudo rm -f /etc/init.d/ynh-vpnclient
  8. # Remove confs
  9. sudo rm -f /etc/openvpn/client.conf{.tpl,}
  10. sudo rm -f /etc/nginx/conf.d/${domain}.d/vpnadmin.conf
  11. sudo rm -f /etc/php5/fpm/pool.d/vpnadmin.conf
  12. # Remove certificates
  13. sudo rm -rf /etc/openvpn/keys/
  14. # Restart services
  15. sudo yunohost service stop php5-fpm
  16. sudo yunohost service start php5-fpm
  17. sudo service nginx reload
  18. # Remove sources
  19. sudo rm -rf /var/www/vpnadmin/
  20. # Remove user
  21. sudo userdel -f vpnadmin
  22. # Restart hotspot service if installed to change NAT configuration
  23. sudo yunohost app list -f hotspot --json | grep -q '"installed": true'
  24. if [ "$?" -eq 0 ]; then
  25. sleep 2
  26. sudo yunohost service stop ynh-hotspot
  27. sudo yunohost service start ynh-hotspot
  28. fi
  29. # Remove packets
  30. # The yunohost policy is currently to not uninstall packets (dependency problems)
  31. ## sudo apt-get --assume-yes --force-yes remove openvpn php5-fpm
  32. ## sudo apt-get --assume-yes --force-yes remove sipcalc
  33. exit 0