remove 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. # 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 yunohost service start ynh-hotspot
  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. ## sudo apt-get --assume-yes --force-yes remove sipcalc
  32. exit 0