install 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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=$2
  36. app=$YNH_APP_INSTANCE_NAME
  37. #=================================================
  38. # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
  39. #=================================================
  40. # Check destination directory
  41. final_path="/var/www/$app"
  42. test ! -e "$final_path" || ynh_die "Path is already in use: ${final_path}."
  43. # Normalize the url path syntax
  44. path_url=$(ynh_normalize_url_path "$path_url")
  45. # Check web path availability
  46. ynh_webpath_available "$domain" "$path_url"
  47. # Register (book) web path
  48. ynh_webpath_register "$app" "$domain" "$path_url"
  49. #=================================================
  50. # STORE SETTINGS FROM MANIFEST
  51. #=================================================
  52. ynh_app_setting_set "$app" domain "$domain"
  53. ynh_app_setting_set "$app" final_path "$final_path"
  54. #=================================================
  55. # STANDARD MODIFICATIONS
  56. #=================================================
  57. # INSTALL DEPENDENCIES
  58. #=================================================
  59. ynh_install_app_dependencies "$pkg_dependencies"
  60. #=================================================
  61. # DEPLOY FILES FROM PACKAGE
  62. #=================================================
  63. vpnclient_deploy_files_and_services "${domain}" "${app}"
  64. ynh_app_setting_set $app final_path $final_path
  65. # Set default inits
  66. # The boot order of these services are important, so they are disabled by default
  67. # and the ynh-vpnclient service handles them.
  68. sudo systemctl disable openvpn
  69. sudo systemctl stop openvpn
  70. sudo systemctl enable php5-fpm
  71. sudo systemctl restart php5-fpm
  72. sudo systemctl reload nginx
  73. sudo systemctl enable ynh-vpnclient
  74. sudo yunohost service add ynh-vpnclient
  75. ynh_systemctl start ynh-vpnclient-checker.service
  76. sudo systemctl enable ynh-vpnclient-checker.service
  77. ynh_systemctl start ynh-vpnclient-checker.timer
  78. sudo systemctl enable ynh-vpnclient-checker.timer
  79. sudo yunohost app ssowatconf