network: utiliser 127.0.1.1 pour dhcp
This commit is contained in:
parent
dfb5fc31d8
commit
a75b91e2e9
|
@ -705,10 +705,9 @@ iface lo inet loopback
|
|||
|
||||
# si on ne spécifie pas l'adresse ip principale, la résoudre ici. ceci
|
||||
# est nécessaire pour mettre à jour /etc/hosts
|
||||
if [ "$mainip" == dhcp ]; then
|
||||
# si l'adresse obtenue est en DHCP, ne pas mettre à jour /etc/hosts
|
||||
mainip=
|
||||
elif [ -z "$mainip" ]; then
|
||||
# si mainip == dhcp, c'est pris en charge par network_fix_hosts qui
|
||||
# utilisera 127.0.1.1 à la place
|
||||
if [ -z "$mainip" ]; then
|
||||
local -a mainips
|
||||
resolv_ips mainips "$host"
|
||||
[ -n "${mainips[*]}" ] || {
|
||||
|
|
|
@ -635,12 +635,19 @@ function network_fix_postfix() {
|
|||
}
|
||||
|
||||
function network_fix_hosts() {
|
||||
local host="$1" hostname="${1%%.*}"; local shost="${host//./\\.}"
|
||||
local ip="$2"; local sip="${ip//./\\.}"
|
||||
local oldhost="$3" oldhostname="${3%%.*}"; soldhost="${host//./\\.}"
|
||||
local tmpfile; ac_set_tmpfile tmpfile
|
||||
local modified
|
||||
|
||||
local host="$1" hostname="${1%%.*}"
|
||||
local shost="${host//./\\.}"
|
||||
|
||||
local ip="$2"
|
||||
[ "$ip" == dhcp ] && ip=127.0.1.1
|
||||
local sip="${ip//./\\.}"
|
||||
|
||||
local oldhost="$3" oldhostname="${3%%.*}"
|
||||
local soldhost="${host//./\\.}"
|
||||
|
||||
awkrun </etc/hosts >"$tmpfile" \
|
||||
host="$host" hostname="$hostname" \
|
||||
ip="$ip" \
|
||||
|
|
Loading…
Reference in New Issue