diff --git a/scripts/_common.sh b/scripts/_common.sh index bd894b7..1f12ecb 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,6 +5,9 @@ pkg_dependencies="php7.0-fpm sipcalc dnsutils openvpn curl fake-hwclock" +service_name="ynh-vpnclient" +service_checker_name=$service_name"-checker" + to_logs() { # When yunohost --verbose or bash -x @@ -200,7 +203,3 @@ function vpnclient_deploy_files_and_services() ynh_add_systemd_config $service_checker_name "$service_checker_name.service" } - -function service_is_managed_by_yunohost() { - yunohost service status $1 >/dev/null 2>&1 -} diff --git a/scripts/backup b/scripts/backup index 0eb4a93..cbaa1ef 100644 --- a/scripts/backup +++ b/scripts/backup @@ -25,8 +25,6 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get $app final_path) domain=$(ynh_app_setting_get $app domain) -service_name=$(ynh_app_setting_get $app service_name) -service_checker_name=$service_name"-checker" #================================================= # STANDARD BACKUP STEPS diff --git a/scripts/install b/scripts/install index 9409b99..fda83fe 100644 --- a/scripts/install +++ b/scripts/install @@ -43,9 +43,6 @@ path_url=$(ynh_normalize_url_path "$YNH_APP_ARG_PATH") app=$YNH_APP_INSTANCE_NAME final_path="/var/www/$app" -service_name="ynh-vpnclient" -service_checker_name=$service_name"-checker" - #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= @@ -64,7 +61,6 @@ ynh_print_info "Storing installation settings..." ynh_app_setting_set "$app" domain "$domain" ynh_app_setting_set "$app" final_path "$final_path" -ynh_app_setting_set "$app" service_name "$service_name" #================================================= # STANDARD MODIFICATIONS diff --git a/scripts/remove b/scripts/remove index f3fbfa1..359a8f3 100644 --- a/scripts/remove +++ b/scripts/remove @@ -33,8 +33,6 @@ ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) -service_name=$(ynh_app_setting_get $app service_name) -service_checker_name=$service_name"-checker" #================================================= # STOP AND REMOVE SERVICES diff --git a/scripts/restore b/scripts/restore index c9bb95b..884e0f9 100644 --- a/scripts/restore +++ b/scripts/restore @@ -26,8 +26,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) path_url=$(ynh_app_setting_get $app path) final_path=$(ynh_app_setting_get $app final_path) -service_name=$(ynh_app_setting_get $app service_name) -service_checker_name=$service_name"-checker" #================================================= # CHECK IF THE APP CAN BE RESTORED diff --git a/scripts/upgrade b/scripts/upgrade index f8e76cc..7843dbb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,10 +20,6 @@ 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) -service_name=$(ynh_app_setting_get $app service_name) -service_checker_name=$service_name"-checker" - #================================================= # SPECIAL UPGRADE FOR VERSIONS < 1.2.0 @@ -42,12 +38,6 @@ if [ -f /etc/php5/fpm/pool.d/vpnadmin.conf ]; then fi test -d /var/www/vpnadmin && mv /var/www/vpnadmin /var/www/${app} -if [ -z $service_name ]; then - service_name="ynh-vpnclient" - service_checker_name=$service_name"-checker" - ynh_app_setting_set "$app" service_name "$service_name" -fi - ## Versions known to have a buggy backup script #buggy_versions="1.0.0 1.0.1 1.1.0" #curr_version=$(read_manifest version) @@ -101,19 +91,9 @@ systemctl reload nginx ### Make sure that the yunohost services have a description and need-lock enabled # main service - -if service_is_managed_by_yunohost $service_name -then - yunohost service remove $service_name -fi yunohost service add $service_name --description "Tunnels the internet traffic through a VPN" --need_lock # checker service - -if service_is_managed_by_yunohost $service_checker_name -then - yunohost service remove $service_checker_name -fi yunohost service add $service_checker_name --description "Makes sure that the VPN service is running" --need_lock # Reload systemd configuration