From 3b7e0608c42402433888f9129e8c9dacbb9f4797 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 20 Jan 2019 18:04:13 +0100 Subject: [PATCH] Fix #37 --- scripts/actions/reset_default_config | 2 +- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/actions/reset_default_config b/scripts/actions/reset_default_config index c38ec23..c52dd55 100755 --- a/scripts/actions/reset_default_config +++ b/scripts/actions/reset_default_config @@ -41,7 +41,7 @@ if [ "$file" = "setupVars.conf" ] then # Recreate the default config # Trouve l'interface réseau par défaut - main_iface=$(ip route | grep default | awk '{print $5;}') + main_iface=$(ip route | grep --max-count=1 default | awk '{print $5;}') echo "PIHOLE_INTERFACE=$main_iface" > "$config_file" echo "IPV4_ADDRESS=127.0.0.1" >> "$config_file" echo "IPV6_ADDRESS=" >> "$config_file" diff --git a/scripts/install b/scripts/install index 174c320..abd1c23 100644 --- a/scripts/install +++ b/scripts/install @@ -197,7 +197,7 @@ ynh_exec_warn_less systemctl enable pihole-FTL setupVars="$pihole_storage/setupVars.conf" # Get the default network interface -main_iface=$(ip route | grep default | awk '{print $5;}') +main_iface=$(ip route | grep --max-count=1 default | awk '{print $5;}') echo "PIHOLE_INTERFACE=$main_iface" > $setupVars echo "IPV4_ADDRESS=127.0.0.1" >> $setupVars echo "IPV6_ADDRESS=" >> $setupVars diff --git a/scripts/restore b/scripts/restore index 1782cb6..59f3c07 100644 --- a/scripts/restore +++ b/scripts/restore @@ -150,7 +150,7 @@ ynh_replace_string "^cache-size=" "#pihole# cache-size=" /etc/dnsmasq.conf #================================================= # Get the default network interface -main_iface=$(ip route | grep default | awk '{print $5;}') +main_iface=$(ip route | grep --max-count=1 default | awk '{print $5;}') # Find the IP associated to the network interface localipv4=$(ip address | grep "${main_iface}\$" | awk '{print $2;}' | cut -d/ -f1) diff --git a/scripts/upgrade b/scripts/upgrade index 37500dc..435675c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -223,7 +223,7 @@ then ynh_backup_if_checksum_is_different "$setupVars" # Get the default network interface - main_iface=$(ip route | grep default | awk '{print $5;}') + main_iface=$(ip route | grep --max-count=1 default | awk '{print $5;}') echo "PIHOLE_INTERFACE=$main_iface" > $setupVars echo "IPV4_ADDRESS=127.0.0.1" >> $setupVars echo "IPV6_ADDRESS=" >> $setupVars