Browse Source

No more service_name

Kayou 6 years ago
parent
commit
0d668765e5
6 changed files with 3 additions and 34 deletions
  1. 3 4
      scripts/_common.sh
  2. 0 2
      scripts/backup
  3. 0 4
      scripts/install
  4. 0 2
      scripts/remove
  5. 0 2
      scripts/restore
  6. 0 20
      scripts/upgrade

+ 3 - 4
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
-}

+ 0 - 2
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

+ 0 - 4
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

+ 0 - 2
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

+ 0 - 2
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

+ 0 - 20
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