Browse Source

ip6_net/addr -> change 'none' to empty string for better config panel integration / optional management etc (none ain't a valid IPv6 address)

Alexandre Aubin 3 years ago
parent
commit
4031ed4567
3 changed files with 17 additions and 3 deletions
  1. 1 1
      conf/ynh-hotspot
  2. 2 2
      scripts/install
  3. 14 0
      scripts/upgrade

+ 1 - 1
conf/ynh-hotspot

@@ -27,7 +27,7 @@ has_vpnclient_app() {
 has_ip6delegatedprefix() {
   i=${1}
 
-  [ "${ynh_ip6_net[${i}]}" != none ]
+  [[ -n "${ynh_ip6_net[${i}]}" ]] && [[ "${ynh_ip6_net[${i}]}" != "none" ]]
 }
 
 is_nat_set() {

+ 2 - 2
scripts/install

@@ -118,8 +118,8 @@ ynh_system_user_create --username=$app
 ynh_script_progression --message="Configuring hotspot..."
 
 if [[ ! -v ip6_net ]]; then # if ip6_net not set
-	ip6_net=none
-	ip6_addr=none
+	ip6_net=""
+	ip6_addr=""
 
 	if [[ -e /tmp/.ynh-vpnclient-started ]]; then
 		vpnclient_ip6_net=$(ynh_app_setting_get vpnclient ip6_net 2>&1)

+ 14 - 0
scripts/upgrade

@@ -73,6 +73,20 @@ fi
 
 # Old stuff prior to 2.x
 
+ip6_net=$(ynh_app_setting_get --app=$app --key=ip6_net)
+if [ "$ip6_net" == "none" ]
+then
+    ip6_net=""
+	ynh_app_setting_set --app=$app --key=ip6_net --value="$ip6_net"
+fi
+
+ip6_addr=$(ynh_app_setting_get --app=$app --key=ip6_addr)
+if [ "$ip6_addr" == "none" ]
+then
+    ip6_addr=""
+	ynh_app_setting_set --app=$app --key=ip6_addr --value="$ip6_addr"
+fi
+
 if [ -f /etc/nginx/conf.d/*.d/$app.conf ]; then
 	ynh_secure_remove /etc/nginx/conf.d/*.d/$app.conf
     ynh_systemd_action --service_name=nginx --action=reload