diff --git a/scripts/_common.sh b/scripts/_common.sh index 8f10e9a..989b54f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -81,8 +81,14 @@ process_ips(){ if is_public_ip "$ip" && [ "$open_port_53" == "false" ] ; then break else - processed_ips="$ip" - break + if [[ $is_install = true ]]; then + # to get a dash before each IP + processed_ips="- $ip" + break + else + processed_ips="$ip" + break + fi fi fi done diff --git a/scripts/install b/scripts/install index 3fb1995..7715119 100644 --- a/scripts/install +++ b/scripts/install @@ -84,12 +84,14 @@ ipv6_interface="$(get_network_interface 6)" # put the network interface in a dedicated dnsmasq config configure_network_interface_dnsmasq "$ipv4_interface" "$ipv6_interface" -# get IPv4 for the AGH config file (with a starting "- ") -ipv4_addr=$(echo "- " "$(process_ips "$(ip -4 address show "$ipv4_interface" 2> /dev/null | grep inet)")") +# to warn process_ips that we're doing an installation (to get a dash before each IP) +is_install=true +# get IPv4 for the AGH config file +ipv4_addr=$(process_ips "$(ip -4 address show "$ipv4_interface" 2> /dev/null | grep inet)") -# get IPv6 for the AGH config file (with a starting "- ") +# get IPv6 for the AGH config file # the 'sed' is used to get rid of the network prefix ('/64' for example) -ipv6_addr=$(echo "- " "$(process_ips "$(ip -6 address show "$ipv6_interface" 2> /dev/null | grep inet | sed 's&/.*&&')")") +ipv6_addr=$(process_ips "$(ip -6 address show "$ipv6_interface" 2> /dev/null | grep inet | sed 's&/.*&&')") password=$(python3 -c "import bcrypt; print(bcrypt.hashpw(b\"$password\", bcrypt.gensalt(rounds=10)).decode())") ynh_app_setting_set --app="$app" --key=password --value="$password"