afficher ce qui est fait

This commit is contained in:
Jephté Clain 2014-01-28 16:29:37 +04:00
parent c6727703ef
commit 753cb6c489
1 changed files with 51 additions and 9 deletions

View File

@ -127,6 +127,11 @@ function __network_hostname() {
uecho "Setting /etc/hostname to $hostname"
elif [ "$(</etc/hostname)" != "$hostname" ]; then
__network_backup /etc/hostname
if show_debug; then
edebug "Setting /etc/hostname to $hostname"
else
estep /etc/hostname
fi
echo "$hostname" >/etc/hostname
fi
}
@ -138,6 +143,11 @@ function __network_mailname() {
uecho "Setting /etc/mailname to $host"
elif [ "$(</etc/mailname)" != "$host" ]; then
__network_backup /etc/mailname
if show_debug; then
edebug "Setting /etc/mailname to $host"
else
estep /etc/mailname
fi
echo "$host" >/etc/mailname
fi
}
@ -158,6 +168,12 @@ dc_other_hostnames='$host'"
fi
elif testdiff "$tmpfile" /etc/exim4/update-exim4.conf.conf; then
__network_backup /etc/exim4/update-exim4.conf.conf
if show_debug; then
edebug "Setting /etc/exim4/update-exim4.conf.conf to:"
cat "$tmpfile" | sed 's/^/ /g' 1>&2
else
estep /etc/exim4/update-exim4.conf.conf
fi
cat "$tmpfile" >/etc/exim4/update-exim4.conf.conf
update-exim4.conf
fi
@ -186,6 +202,12 @@ function __network_fix_postfix() {
fi
elif testdiff "$tmpfile" /etc/postfix/main.cf; then
__network_backup /etc/postfix/main.cf
if show_debug; then
edebug "Setting /etc/postfix/main.cf to:"
cat "$tmpfile" | sed 's/^/ /g' 1>&2
else
estep /etc/postfix/main.cf
fi
cat "$tmpfile" >/etc/postfix/main.cf
fi
ac_clean "$tmpfile"
@ -219,6 +241,12 @@ $ip$TAB$host $hostname" "$tmpfile"
fi
elif testdiff "$tmpfile" /etc/hosts; then
__network_backup /etc/hosts
if show_debug; then
edebug "Setting /etc/hosts to:"
cat "$tmpfile" | sed 's/^/ /g' 1>&2
else
estep /etc/hosts
fi
cat "$tmpfile" >/etc/hosts
fi
ac_clean "$tmpfile"
@ -359,7 +387,7 @@ $1 == "0.0.0.0" && $8 == iface {
print gatewayvar "=\"" $2 "\""
}')"
}
#BUG")"
#BUG)"
function __network_set_confips() {
local -a __nsc_confips __nsc_ifaces __nsc_supplips
@ -475,8 +503,12 @@ BEGIN {
gateway = ""
}
if (i == 1) {
if (ip == "dhcp") method = "dhcp"
else method = "static"
if (ip == "dhcp") {
method = "dhcp"
} else {
method = "static"
mainip = ip
}
}
if (suffix == "") suffix = "24"
ips[i] = ip
@ -500,8 +532,12 @@ BEGIN {
gateway = ""
}
if (i == 1) {
if (ip == "dhcp") method = "dhcp"
else method = "static"
if (ip == "dhcp") {
method = "dhcp"
} else {
method = "static"
mainip = ip
}
}
if (suffix == "") suffix = "24"
ips[i] = ip
@ -789,7 +825,10 @@ in_iface && $0 ~ "^[ \\t]*down (/sbin/)?ip addr del " {
}
next
}
$1 == "iface" { in_iface = 0; next; }
$1 == "iface" {
in_iface = 0
next
}
$1 == "allow-hotplug" {
if (($0 " ") ~ (" " iface " ")) have_hotplug = 1
in_iface = 0
@ -1019,6 +1058,12 @@ iface lo inet loopback
fi
elif testdiff "$interfaces" /etc/network/interfaces; then
__network_backup /etc/network/interfaces
if show_debug; then
edebug "Setting /etc/network/interfaces to:"
cat "$interfaces" | sed 's/^/ /g' 1>&2
else
estep /etc/network/interfaces
fi
cat "$interfaces" >/etc/network/interfaces
fi
ac_clean "$interfaces" "$workfile"
@ -1046,12 +1091,9 @@ iface lo inet loopback
mainip="${mainips[0]}"
fi
estep "/etc/hostname"
__network_hostname "$host"
estep "/etc/mailname"
__network_mailname "$host"
if [ -n "$mainip" ]; then
estep "/etc/hosts"
__network_hosts "$host" "$mainip"
fi