From 4c6de3701cb9edb4578d39786bfe66a8c9dfa6f9 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Thu, 28 Dec 2023 07:03:57 +0100 Subject: [PATCH] fix ipv4 getting --- scripts/config | 4 ++-- scripts/install | 3 ++- scripts/restore | 3 ++- scripts/upgrade | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/config b/scripts/config index a9b878a..5bddc71 100644 --- a/scripts/config +++ b/scripts/config @@ -38,8 +38,8 @@ set__open_port_53() { ipv4_interface="$(get_network_interface 4)" ipv6_interface="$(get_network_interface 6)" - # get IPv4 for the AGH config file - ipv4_addr=$(process_ips "$(ip -4 address show "$ipv4_interface" 2> /dev/null | grep inet)") + # the 'sed' is used to get rid of the network prefix ('/24' for example) and the router IP + ipv4_addr=$(process_ips "$(ip -4 address show "$ipv4_interface" 2> /dev/null | grep inet | sed 's&/.*&&')") # get IPv6 for the AGH config file # the 'sed' is used to get rid of the network prefix ('/64' for example) diff --git a/scripts/install b/scripts/install index 20eea4f..746c949 100644 --- a/scripts/install +++ b/scripts/install @@ -87,7 +87,8 @@ configure_network_interface_dnsmasq "$ipv4_interface" "$ipv6_interface" # 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)") +# the 'sed' is used to get rid of the network prefix ('/24' for example) and the router IP +ipv4_addr=$(process_ips "$(ip -4 address show "$ipv4_interface" 2> /dev/null | grep inet | sed 's&/.*&&')") # get IPv6 for the AGH config file # the 'sed' is used to get rid of the network prefix ('/64' for example) diff --git a/scripts/restore b/scripts/restore index 961a845..322612c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -52,7 +52,8 @@ ipv6_interface="$(get_network_interface 6)" configure_network_interface_dnsmasq "$ipv4_interface" "$ipv6_interface" # get IPv4 for the AGH config file -ipv4_addr=$(process_ips "$(ip -4 address show "$ipv4_interface" 2> /dev/null | grep inet)") +# the 'sed' is used to get rid of the network prefix ('/24' for example) and the router IP +ipv4_addr=$(process_ips "$(ip -4 address show "$ipv4_interface" 2> /dev/null | grep inet | sed 's&/.*&&')") # get IPv6 for the AGH config file # the 'sed' is used to get rid of the network prefix ('/64' for example) diff --git a/scripts/upgrade b/scripts/upgrade index 4f42065..8fb3e76 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -129,7 +129,8 @@ ipv4_interface="$(get_network_interface 4)" ipv6_interface="$(get_network_interface 6)" # get IPv4 for the AGH config file -ipv4_addr=$(process_ips "$(ip -4 address show "$ipv4_interface" 2> /dev/null | grep inet)") +# the 'sed' is used to get rid of the network prefix ('/24' for example) and the router IP +ipv4_addr=$(process_ips "$(ip -4 address show "$ipv4_interface" 2> /dev/null | grep inet | sed 's&/.*&&')") # get IPv6 for the AGH config file # the 'sed' is used to get rid of the network prefix ('/64' for example)