install 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 START
  20. #=================================================
  21. # IMPORT GENERIC HELPERS
  22. #=================================================
  23. source /usr/share/yunohost/helpers
  24. source _common.sh
  25. #=================================================
  26. # MANAGE SCRIPT FAILURE
  27. #=================================================
  28. # Exit if an error occurs during the execution of the script
  29. ynh_abort_if_errors
  30. #=================================================
  31. # RETRIEVE ARGUMENTS FROM THE MANIFEST
  32. #=================================================
  33. # Retrieve arguments
  34. domain=$1
  35. path_url=$(ynh_normalize_url_path "$2")
  36. app=$YNH_APP_INSTANCE_NAME
  37. final_path="/var/www/$app"
  38. #=================================================
  39. # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
  40. #=================================================
  41. # Check destination directory
  42. test ! -e "$final_path" || ynh_die "Path is already in use: ${final_path}."
  43. # Register (book) web path
  44. ynh_webpath_register "$app" "$domain" "$path_url"
  45. #=================================================
  46. # STORE SETTINGS FROM MANIFEST
  47. #=================================================
  48. ynh_app_setting_set "$app" domain "$domain"
  49. ynh_app_setting_set "$app" final_path "$final_path"
  50. #=================================================
  51. # STANDARD MODIFICATIONS
  52. #=================================================
  53. # INSTALL DEPENDENCIES
  54. #=================================================
  55. ynh_install_app_dependencies "$pkg_dependencies"
  56. #=================================================
  57. # DEPLOY FILES FROM PACKAGE
  58. #=================================================
  59. vpnclient_deploy_files_and_services "${domain}" "${app}"
  60. # Set default inits
  61. # The boot order of these services are important, so they are disabled by default
  62. # and the ynh-vpnclient service handles them.
  63. systemctl disable openvpn
  64. systemctl stop openvpn
  65. systemctl enable php5-fpm
  66. systemctl restart php5-fpm
  67. systemctl reload nginx
  68. systemctl enable ynh-vpnclient
  69. yunohost service add ynh-vpnclient
  70. ynh_systemctl start ynh-vpnclient-checker.service
  71. systemctl enable ynh-vpnclient-checker.service
  72. ynh_systemctl start ynh-vpnclient-checker.timer
  73. systemctl enable ynh-vpnclient-checker.timer
  74. yunohost app ssowatconf