Parcourir la source

Merge pull request #54 from keomabrun/dev_53

fix #53
Keoma Brun il y a 6 ans
Parent
commit
73aa672346
2 fichiers modifiés avec 12 ajouts et 2 suppressions
  1. 4 0
      scripts/_common.sh
  2. 8 2
      scripts/upgrade

+ 4 - 0
scripts/_common.sh

@@ -212,3 +212,7 @@ function vpnclient_deploy_files_and_services()
   # Reload systemd configuration
   systemctl daemon-reload
 }
+
+function service_is_managed_by_yunohost() {
+  yunohost service status $1 >/dev/null 2>&1
+}

+ 8 - 2
scripts/upgrade

@@ -93,12 +93,18 @@ systemctl reload nginx
 
 # main service
 
-yunohost service remove $service_name
+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
 
-yunohost service remove $service_checker_name
+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