remove 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. # Retrieve arguments
  3. domain=$(sudo yunohost app setting vpnclient domain)
  4. # The End
  5. sudo service ynh-vpnclient stop
  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. # A new start will fix the interface without unsetting all stuff
  24. sudo yunohost app list -f hotspot --json | grep -q '"installed": true'
  25. if [ "$?" -eq 0 ]; then
  26. sudo service ynh-hotspot start
  27. fi
  28. # Remove packets
  29. # The yunohost policy is currently to not uninstall packets (dependency problems)
  30. ## sudo apt-get --assume-yes --force-yes remove openvpn php5-fpm
  31. exit 0