12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- #!/bin/bash
- # VPN Client app for YunoHost
- # Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
- # Contribute at https://github.com/labriqueinternet/vpnclient_ynh
- #
- # This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU Affero General Public License as published by
- # the Free Software Foundation, either version 3 of the License, or
- # (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU Affero General Public License for more details.
- #
- # You should have received a copy of the GNU Affero General Public License
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
- #=================================================
- # GENERIC START
- #=================================================
- # IMPORT GENERIC HELPERS
- #=================================================
- source /usr/share/yunohost/helpers
- source _common.sh
- #=================================================
- # MANAGE SCRIPT FAILURE
- #=================================================
- # Exit if an error occurs during the execution of the script
- ynh_abort_if_errors
- #=================================================
- # RETRIEVE ARGUMENTS FROM THE MANIFEST
- #=================================================
- # Retrieve arguments
- domain=$1
- path_url=$(ynh_normalize_url_path "$2")
- app=$YNH_APP_INSTANCE_NAME
- final_path="/var/www/$app"
- #=================================================
- # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
- #=================================================
- # Check destination directory
- test ! -e "$final_path" || ynh_die "Path is already in use: ${final_path}."
- # Register (book) web path
- ynh_webpath_register "$app" "$domain" "$path_url"
- #=================================================
- # STORE SETTINGS FROM MANIFEST
- #=================================================
- ynh_app_setting_set "$app" domain "$domain"
- ynh_app_setting_set "$app" final_path "$final_path"
- #=================================================
- # STANDARD MODIFICATIONS
- #=================================================
- # INSTALL DEPENDENCIES
- #=================================================
- ynh_install_app_dependencies "$pkg_dependencies"
- #=================================================
- # DEPLOY FILES FROM PACKAGE
- #=================================================
- vpnclient_deploy_files_and_services "${domain}" "${app}"
- # Set default inits
- # The boot order of these services are important, so they are disabled by default
- # and the ynh-vpnclient service handles them.
- systemctl disable openvpn
- systemctl stop openvpn
- systemctl enable php5-fpm
- systemctl restart php5-fpm
- systemctl reload nginx
- systemctl enable ynh-vpnclient
- yunohost service add ynh-vpnclient
- ynh_systemctl start ynh-vpnclient-checker.service
- systemctl enable ynh-vpnclient-checker.service
- ynh_systemctl start ynh-vpnclient-checker.timer
- systemctl enable ynh-vpnclient-checker.timer
- yunohost app ssowatconf
|