96 lines
2.8 KiB
Bash
96 lines
2.8 KiB
Bash
#!/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=$YNH_APP_ARG_DOMAIN
|
|
path_url=$YNH_APP_ARG_PATH
|
|
|
|
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
|
|
|
|
|
|
# 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
|