Parcourir la source

apply auto patch helpers 2.1

HgO il y a 1 mois
Parent
commit
efe037f2ec
5 fichiers modifiés avec 14 ajouts et 13 suppressions
  1. 4 3
      scripts/config
  2. 2 2
      scripts/install
  3. 1 1
      scripts/remove
  4. 2 2
      scripts/restore
  5. 5 5
      scripts/upgrade

+ 4 - 3
scripts/config

@@ -239,7 +239,8 @@ ynh_app_config_apply() {
     _ynh_app_config_apply
 
     # If we are uploading a cube file, then the file would be in a temporary folder
-    # Otherwise, we aren't uploading a cube file, then the path is either empty 
+    # Otherwise, we aren't uploading a cube file, then the path is either empty
+
     # or takes the value of the previous upload, that is, the target path for the cube file.
     if [[ -n "${cube_file:-}" && "$cube_file" != "/etc/openvpn/client.cube" ]]; then
       ynh_app_setting_set $app ip6_addr "$ip6_addr"
@@ -251,8 +252,8 @@ ynh_app_config_apply() {
         install -b -o root -g root -m 0755 ../conf/optional-scripts/route-up.d/50-vpnclient-set-ipv6-send-over-tun /etc/openvpn/scripts/route-up.d/
         install -b -o root -g root -m 0755 ../conf/optional-scripts/route-down.d/50-vpnclient-unset-ipv6-send-over-tun /etc/openvpn/scripts/route-down.d/
     else
-        ynh_secure_remove /etc/openvpn/scripts/route-up.d/50-vpnclient-set-ipv6-send-over-tun
-        ynh_secure_remove /etc/openvpn/scripts/route-down.d/50-vpnclient-unset-ipv6-send-over-tun
+        ynh_safe_rm /etc/openvpn/scripts/route-up.d/50-vpnclient-set-ipv6-send-over-tun
+        ynh_safe_rm /etc/openvpn/scripts/route-down.d/50-vpnclient-unset-ipv6-send-over-tun
     fi
 
     set_permissions /etc/openvpn/client.conf

+ 2 - 2
scripts/install

@@ -34,8 +34,8 @@ systemctl stop openvpn
 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
 
-ynh_use_logrotate --logfile="/var/log/ynh-vpnclient.log"
-ynh_use_logrotate --logfile="/var/log/openvpn-client.log"
+ynh_config_add_logrotate "/var/log/ynh-vpnclient.log"
+ynh_config_add_logrotate "/var/log/openvpn-client.log"
 
 # checker service
 

+ 1 - 1
scripts/remove

@@ -16,7 +16,7 @@ systemctl disable $service_checker_name --quiet
 if ynh_hide_warnings yunohost service status $service_name >/dev/null; then
     yunohost service remove $service_name
 fi
-ynh_remove_logrotate
+ynh_config_remove_logrotate
 
 for FILE in $(ls /etc/systemd/system/$service_name* /usr/local/bin/ynh-vpnclient* /tmp/.ynh-vpnclient-*); do
     ynh_safe_rm "$FILE"

+ 2 - 2
scripts/restore

@@ -27,8 +27,8 @@ systemctl stop openvpn
 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"
 
-ynh_use_logrotate --logfile="/var/log/ynh-vpnclient.log"
-ynh_use_logrotate --logfile="/var/log/openvpn-client.log"
+ynh_config_add_logrotate "/var/log/ynh-vpnclient.log"
+ynh_config_add_logrotate "/var/log/openvpn-client.log"
 
 # checker service
 

+ 5 - 5
scripts/upgrade

@@ -37,7 +37,7 @@ if [ -e "/etc/sudoers.d/${app}_ynh" ]; then
 fi
 
 if [ -e "/etc/yunohost/hooks.d/90-vpnclient.tpl" ]; then
-  ynh_secure_remove "/etc/yunohost/hooks.d/90-vpnclient.tpl"
+  ynh_safe_rm "/etc/yunohost/hooks.d/90-vpnclient.tpl"
 fi
 
 if [ -e "/etc/openvpn/client.conf.tpl" ]; then
@@ -64,7 +64,7 @@ if [ -z "${ip6_net:-}" ]; then
     ynh_app_setting_set --key=ip6_net --value=""
 fi
 if [ -z "${ip6_send_over_tun_enabled:-}" ]; then
-    ynh_app_setting_set --app=$app --key=ip6_send_over_tun_enabled --value=0
+    ynh_app_setting_set --key=ip6_send_over_tun_enabled --value=0
 fi
 
 #=================================================
@@ -117,7 +117,7 @@ for config_file in ${tmp_dir}/client.{conf,cube,ovpn}; do
     cp "${config_file}" /etc/openvpn/
   fi
 done
-ynh_safe_remove ${tmp_dir}
+ynh_safe_rm ${tmp_dir}
 
 #=================================================
 # SERVICE INTEGRATION IN YUNOHOST
@@ -129,8 +129,8 @@ ynh_print_info "Configuring VPN client services..."
 # 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"
 
-ynh_use_logrotate --logfile="/var/log/ynh-vpnclient.log"
-ynh_use_logrotate --logfile="/var/log/openvpn-client.log"
+ynh_config_add_logrotate "/var/log/ynh-vpnclient.log"
+ynh_config_add_logrotate "/var/log/openvpn-client.log"
 
 # checker service (this service was previously integrated in yunohost but we do not do this anymore)
 if ynh_hide_warnings yunohost service status $service_checker_name >/dev/null