traiter les anciennes occurences de host, même si pas localhost
This commit is contained in:
parent
a0130ab206
commit
445bbe90ff
11
ulib/debian
11
ulib/debian
|
@ -163,9 +163,16 @@ function __network_fix_exim4() {
|
|||
|
||||
function __network_hosts() {
|
||||
local host="$1" hostname="${1%%.*}" ip="$2"
|
||||
local shost="${host//./\\.}"
|
||||
local tmpfile; ac_set_tmpfile tmpfile
|
||||
</etc/hosts sed "/^127\\./s/$hostname\\(\\.[^ $TAB]*\\)\\?[ $TAB]*//g;
|
||||
/^127\\.[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+[ $TAB]*\$/d" >"$tmpfile"
|
||||
awkrun </etc/hosts >"$tmpfile" host="$host" hostname="$hostname" ip="$ip" '
|
||||
/^[^# \t]/ {
|
||||
gsub("[ \\t]+" host "[ \\t]*", " ")
|
||||
gsub("[ \\t]+" hostname "[ \\t]*", " ")
|
||||
if ($0 ~ /^[^ \t]+[ \t]*$/) next
|
||||
gsub(/[ \t]*$/, "")
|
||||
}
|
||||
{ print }'
|
||||
local sip="${ip//./\\.}" shost="${host//./\\.}"
|
||||
if ! quietgrep "^$sip[ $TAB]\\+$shost[ $TAB]\\+$hostname" "$tmpfile"; then
|
||||
sed -i "/^$sip[ $TAB]/d" "$tmpfile"
|
||||
|
|
Loading…
Reference in New Issue