From 4031ed456721299c295c961fde380852301f8907 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 17 Oct 2021 22:09:02 +0200 Subject: [PATCH] ip6_net/addr -> change 'none' to empty string for better config panel integration / optional management etc (none ain't a valid IPv6 address) --- conf/ynh-hotspot | 2 +- scripts/install | 4 ++-- scripts/upgrade | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/conf/ynh-hotspot b/conf/ynh-hotspot index f707d98..683e1da 100644 --- a/conf/ynh-hotspot +++ b/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() { diff --git a/scripts/install b/scripts/install index f183f2d..1e60651 100644 --- a/scripts/install +++ b/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) diff --git a/scripts/upgrade b/scripts/upgrade index f2e5dc0..6ee863e 100644 --- a/scripts/upgrade +++ b/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