From 27f111ef66fffb8e39e9eb6aec86f7076ded5d3d Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Thu, 28 Dec 2023 07:15:42 +0100 Subject: [PATCH] rework process_ips() to effectively get multiple IP if needed --- scripts/_common.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index e054775..fe0c172 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -71,23 +71,19 @@ process_ips(){ # used to process the IPs to put in the AGH's config file local ips="$1" - local processed_ips + local processed_ips="" for i in $(seq "$(echo "$ips" | wc -w)" -1 1); do ip=$(echo "$ips" | awk "{print \$$i}") # check if the so-called IP really is one if ynh_validate_ip4 --ip_address="$ip" || ynh_validate_ip6 --ip_address="$ip"; then # if the IP is public and the user doesn't want to expose port 53, skip it - if is_public_ip "$ip" && [ "$open_port_53" == "false" ] ; then - break - else + if ! is_public_ip "$ip" && ! [ "$open_port_53" == "false" ] ; then if [[ "${is_install:-}" = true ]]; then # to get a dash before each IP - processed_ips="- $ip" - break + processed_ips+="- $ip " else - processed_ips="$ip" - break + processed_ips+="$ip " fi fi fi