Maniack Crudelis 7 лет назад
Родитель
Сommit
3b7e0608c4
4 измененных файлов с 4 добавлено и 4 удалено
  1. 1 1
      scripts/actions/reset_default_config
  2. 1 1
      scripts/install
  3. 1 1
      scripts/restore
  4. 1 1
      scripts/upgrade

+ 1 - 1
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"

+ 1 - 1
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

+ 1 - 1
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)
 

+ 1 - 1
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