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=$2
- app=$YNH_APP_INSTANCE_NAME
- #=================================================
- # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
- #=================================================
- # Check destination directory
- final_path="/var/www/$app"
- test ! -e "$final_path" || ynh_die "Path is already in use: ${final_path}."
- source ./helpers
- source ./prerequisites
- # Check domain/path availability
- if ! $upgrade; then
- ynh_webpath_register vpnclient $domain $url_path || exit 1
- fi
- # Install packages
- packages='php5-fpm sipcalc dnsutils openvpn curl fake-hwclock'
- export DEBIAN_FRONTEND=noninteractive
- #=================================================
- # DEPLOY FILES FROM PACKAGE
- #=================================================
- vpnclient_deploy_files_and_services
- ynh_app_setting_set $app final_path $final_path
- # Set default inits
- # The boot order of these services are important, so they are disabled by default
- # and the ynh-vpnclient service handles them.
- sudo systemctl disable openvpn
- sudo systemctl stop openvpn
- sudo systemctl enable php5-fpm
- sudo systemctl restart php5-fpm
- sudo systemctl reload nginx
- sudo systemctl enable ynh-vpnclient
- sudo yunohost service add ynh-vpnclient
- ynh_systemctl start ynh-vpnclient-checker.service
- sudo systemctl enable ynh-vpnclient-checker.service
- ynh_systemctl start ynh-vpnclient-checker.timer
- sudo systemctl enable ynh-vpnclient-checker.timer
- sudo yunohost app ssowatconf
- exit 0
|