using new helpers and script formatting

This commit is contained in:
Keoma Brun
2018-04-06 23:55:12 +02:00
parent 35f38ec86c
commit 809dc19c80
7 changed files with 173 additions and 60 deletions

View File

@@ -1,16 +1,41 @@
#!/bin/bash
ynh_setting() {
app=${1}
setting=${2}
ynh_app_setting_get $app $setting
}
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ./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
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
is_public=$(ynh_app_setting_get $app is_public)
final_path=$(ynh_app_setting_get $app final_path)
server_name=$(ynh_app_setting_get $app server_name)
#=================================================
# CHECK VERSION
#=================================================
ynh_abort_if_up_to_date
#=================================================
domain=$(ynh_setting vpnclient domain)
path=$(ynh_setting vpnclient path)
server_name=$(ynh_setting vpnclient server_name)
sudo mkdir -m 0700 -p /var/cache/labriqueinternet/vpnclient/
sudo tar czf "/var/cache/labriqueinternet/vpnclient/rollback_$(date +%Y-%m-%d-%H%M%S).tgz" /etc/openvpn/ /etc/yunohost/apps/vpnclient/ &> /dev/null