1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- #!/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 _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
- #=================================================
- # STORE SETTINGS FROM MANIFEST
- #=================================================
- ynh_script_progression "Storing installation settings..."
- # Default values for config panel
- ynh_app_setting_set "$app" service_enabled 0
- ynh_app_setting_set "$app" dns_method "yunohost"
- ynh_app_setting_set "$app" nameservers ""
- ynh_app_setting_set "$app" ip6_addr ""
- ynh_app_setting_set "$app" ip6_net ""
- #=================================================
- # 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
|