#!/bin/bash # VPN Client app for YunoHost # Copyright (C) 2015 Julien Vaubourg # 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 . #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # 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 app=$YNH_APP_INSTANCE_NAME final_path="/var/www/$app" #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= ynh_script_progression "Validating installation parameters..." # Check destination directory test ! -e "$final_path" || ynh_die "Path is already in use: ${final_path}." #================================================= # STORE SETTINGS FROM MANIFEST #================================================= ynh_script_progression "Storing installation settings..." ynh_app_setting_set "$app" final_path "$final_path" # Default values for config panel ynh_app_setting_set "$app" service_enabled 0 ynh_app_setting_set "$app" dns_method "pushed" ynh_app_setting_set "$app" nameservers "" ynh_app_setting_set "$app" ip6_addr "" #================================================= # STANDARD MODIFICATIONS #================================================= # INSTALL DEPENDENCIES #================================================= ynh_script_progression "Installing dependencies..." ynh_install_app_dependencies "$pkg_dependencies" #================================================= # DEPLOY FILES FROM PACKAGE #================================================= ynh_script_progression "Deploy files from package..." vpnclient_deploy_files_and_services #================================================= # RELOAD SERVICES #================================================= ynh_script_progression "Reloading services..." # Set default inits # The boot order of these services are important, so they are disabled by default # and the vpnclient service handles them. systemctl disable openvpn --quiet systemctl stop openvpn # main service yunohost service add $service_name --description "Tunnels the internet traffic through a VPN" --need_lock --test_status="systemctl is-active openvpn@client.service" --log "/var/log/ynh-vpnclient.log" yunohost service enable $service_name # checker service systemctl start $service_checker_name systemctl enable $service_checker_name --quiet systemctl start $service_checker_name.timer systemctl enable $service_checker_name.timer --quiet #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Installation of $app completed" --last