[pkg-dhcp-commits] [SCM] ISC DHCP packaging for Debian branch, master, updated. debian/4.1.1-P1-16.1-14-g02638d8
Andrew Pollock
apollock at debian.org
Thu May 19 05:53:11 UTC 2011
The following commit has been merged in the master branch:
commit ede36eda4529377f383579846e20e3ae06a8dab0
Author: Peter Marschall <peter at adpm.de>
Date: Sat Jan 8 15:23:40 2011 +0100
dhclient-script.*: add comments & empty lines for easier reading
Harmonize "paragraphs" between the 4 dhclient-script implementations.
Signed-off-by: Peter Marschall <peter at adpm.de>
diff --git a/debian/dhclient-script.kfreebsd b/debian/dhclient-script.kfreebsd
index b6f3bfd..ef72750 100644
--- a/debian/dhclient-script.kfreebsd
+++ b/debian/dhclient-script.kfreebsd
@@ -2,15 +2,19 @@
# dhclient-script for GNU/kFreeBSD. Aurelien Jarno, May, 2005.
# Based on Linux and FreeBSD scripts.
+# update /etc/resolv.conf based on received values
make_resolv_conf() {
local new_resolv_conf
+
if [ -n "$new_domain_search" ] || [ -n "$new_domain_name" ] ||
[ -n "$new_domain_name_servers" ]; then
new_resolv_conf=/etc/resolv.conf.dhclient-new
rm -f $new_resolv_conf
+
if [ -n "$new_domain_name" ]; then
echo domain ${new_domain_name%% *} >>$new_resolv_conf
fi
+
if [ -n "$new_domain_search" ]; then
new_domain_search="${new_domain_search% }"
if [ -n "$new_domain_name" ]; then
@@ -20,6 +24,7 @@ make_resolv_conf() {
elif [ -n "$new_domain_name" ]; then
echo "search ${new_domain_name}" >> $new_resolv_conf
fi
+
if [ -n "$new_domain_name_servers" ]; then
for nameserver in $new_domain_name_servers; do
echo nameserver $nameserver >>$new_resolv_conf
@@ -27,12 +32,14 @@ make_resolv_conf() {
else # keep 'old' nameservers
sed -n /^\w*[Nn][Aa][Mm][Ee][Ss][Ee][Rr][Vv][Ee][Rr]/p /etc/resolv.conf >>$new_resolv_conf
fi
+
chown --reference=/etc/resolv.conf $new_resolv_conf
chmod --reference=/etc/resolv.conf $new_resolv_conf
mv -f $new_resolv_conf /etc/resolv.conf
fi
}
+# run given script
run_hook() {
local script
local exit_status
@@ -43,7 +50,6 @@ run_hook() {
. $script "$@"
fi
-
if [ -n "$exit_status" ] && [ "$exit_status" -ne 0 ]; then
logger -p daemon.err "$script returned non-zero exit status $exit_status"
save_exit_status=$exit_status
@@ -52,6 +58,7 @@ run_hook() {
return $exit_status
}
+# run scripts in given directory
run_hookdir() {
local dir
local exit_status
@@ -85,6 +92,8 @@ exit_with_hooks() {
exit $exit_status
}
+
+# set up some variables for DHCPv4 handlers below
if [ -n "$new_broadcast_address" ]; then
new_broadcast_arg="broadcast $new_broadcast_address"
fi
@@ -123,16 +132,17 @@ case "$reason" in
# The DHCP client is requesting that an interface be
# configured as required in order to send packets prior to
# receiving an actual address. - dhclient-script(8)
-
if [ -n "$alias_ip_address" ]; then
ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
fi
+
ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
broadcast 255.255.255.255 up
+
;;
- BOUND|RENEW|REBIND|REBOOT)
+ BOUND|RENEW|REBIND|REBOOT)
if [ -n "$old_host_name" ] && [ -n "$new_host_name" ] &&
[ "$old_host_name" != "$new_host_name" ]; then
hostname "$new_host_name"
@@ -144,6 +154,7 @@ case "$reason" in
ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
fi
+
if [ -n "$old_ip_address" ] &&
[ "$old_ip_address" != "$new_ip_address" ]; then
ifconfig $interface inet -alias $old_ip_address $medium
@@ -163,13 +174,14 @@ case "$reason" in
if [ -z "$old_ip_address" ] ||
[ "$old_ip_address" != "$new_ip_address" ] ||
[ "$reason" = "BOUND" ] || [ "$reason" = "REBOOT" ]; then
-
ifconfig $interface inet $new_ip_address $new_subnet_arg \
$new_broadcast_arg $medium $mtu_arg
route add $new_ip_address 127.1 $metric_arg >/dev/null 2>&1
+
for router in $new_routers; do
route add default $router >/dev/null 2>&1
done
+
if [ -n "$new_static_routes" ]; then
set -- $new_static_routes
while [ $# -gt 1 ]; do
diff --git a/debian/dhclient-script.kfreebsd.udeb b/debian/dhclient-script.kfreebsd.udeb
index 73f556d..335ba28 100644
--- a/debian/dhclient-script.kfreebsd.udeb
+++ b/debian/dhclient-script.kfreebsd.udeb
@@ -10,17 +10,22 @@ set -e
# Updated for Linux 2.[12] by Brian J. Murrell, January 1999.
# Modified for Debian. Matt Zimmerman and Eloy Paris, December 2003
+# update /etc/resolv.conf based on received values
make_resolv_conf() {
local new_resolv_conf
+
if [ -n "$new_domain_name" ] || [ -n "$new_domain_name_servers" ]; then
new_resolv_conf=/etc/resolv.conf.dhclient-new
rm -f $new_resolv_conf
+
if [ -n "$new_domain_name" ]; then
echo "search $new_domain_name" >>$new_resolv_conf
fi
+
for nameserver in $new_domain_name_servers; do
echo "nameserver $nameserver" >>$new_resolv_conf
done
+
mv $new_resolv_conf /etc/resolv.conf
fi
}
@@ -28,11 +33,13 @@ make_resolv_conf() {
set_hostname() {
local current_hostname
current_hostname=$(hostname)
+
if [ -z "$current_hostname" ] || [ "$current_hostname" = "(none)" ]; then
hostname "$new_host_name"
fi
}
+# set up some variables for DHCP handlers below
if [ -n "$new_subnet_mask" ]; then
new_mask="/$(ptom $new_subnet_mask)"
fi
@@ -58,9 +65,10 @@ case "$reason" in
# We need to give the kernel some time to get the interface up.
sleep 1
+
;;
- BOUND|RENEW|REBIND|REBOOT)
+ BOUND|RENEW|REBIND|REBOOT)
set_hostname
if [ -n "$old_ip_address" ] &&
diff --git a/debian/dhclient-script.linux b/debian/dhclient-script.linux
index 12583db..6667c49 100644
--- a/debian/dhclient-script.linux
+++ b/debian/dhclient-script.linux
@@ -12,15 +12,19 @@
# The alias handling in here probably still sucks. -mdz
+# update /etc/resolv.conf based on received values
make_resolv_conf() {
local new_resolv_conf
+
if [ -n "$new_domain_search" ] || [ -n "$new_domain_name" ] ||
[ -n "$new_domain_name_servers" ]; then
new_resolv_conf=/etc/resolv.conf.dhclient-new
rm -f $new_resolv_conf
+
if [ -n "$new_domain_name" ]; then
echo domain ${new_domain_name%% *} >>$new_resolv_conf
fi
+
if [ -n "$new_domain_search" ]; then
#new_domain_search="${new_domain_search% }"
if [ -n "$new_domain_name" ]; then
@@ -39,6 +43,7 @@ make_resolv_conf() {
elif [ -n "$new_domain_name" ]; then
echo "search ${new_domain_name}" >> $new_resolv_conf
fi
+
if [ -n "$new_domain_name_servers" ]; then
for nameserver in $new_domain_name_servers; do
echo nameserver $nameserver >>$new_resolv_conf
@@ -46,12 +51,14 @@ make_resolv_conf() {
else # keep 'old' nameservers
sed -n /^\w*[Nn][Aa][Mm][Ee][Ss][Ee][Rr][Vv][Ee][Rr]/p /etc/resolv.conf >>$new_resolv_conf
fi
+
chown --reference=/etc/resolv.conf $new_resolv_conf
chmod --reference=/etc/resolv.conf $new_resolv_conf
mv -f $new_resolv_conf /etc/resolv.conf
fi
}
+# run given script
run_hook() {
local script
local exit_status
@@ -62,7 +69,6 @@ run_hook() {
. $script "$@"
fi
-
if [ -n "$exit_status" ] && [ "$exit_status" -ne 0 ]; then
logger -p daemon.err "$script returned non-zero exit status $exit_status"
save_exit_status=$exit_status
@@ -71,6 +77,7 @@ run_hook() {
return $exit_status
}
+# run scripts in given directory
run_hookdir() {
local dir
local exit_status
@@ -104,6 +111,8 @@ exit_with_hooks() {
exit $exit_status
}
+
+# set up some variables for DHCPv4 handlers below
if [ -n "$new_broadcast_address" ]; then
new_broadcast_arg="broadcast $new_broadcast_address"
fi
@@ -147,16 +156,16 @@ case "$reason" in
# The DHCP client is requesting that an interface be
# configured as required in order to send packets prior to
# receiving an actual address. - dhclient-script(8)
-
if [ -n "$alias_ip_address" ]; then
# Bring down alias interface. Its routes will disappear too.
ifconfig $interface:0- inet 0
fi
+
ifconfig $interface inet 0 up
;;
- BOUND|RENEW|REBIND|REBOOT)
+ BOUND|RENEW|REBIND|REBOOT)
if [ -n "$old_host_name" ] && [ -n "$new_host_name" ] &&
[ "$old_host_name" != "$new_host_name" ]; then
hostname "$new_host_name"
@@ -173,13 +182,11 @@ case "$reason" in
# IP address changed. Bringing down the interface will delete all routes,
# and clear the ARP cache.
ifconfig $interface inet 0
-
fi
if [ -z "$old_ip_address" ] ||
[ "$old_ip_address" != "$new_ip_address" ] ||
[ "$reason" = "BOUND" ] || [ "$reason" = "REBOOT" ]; then
-
ifconfig $interface inet $new_ip_address $new_subnet_arg \
$new_broadcast_arg $mtu_arg
diff --git a/debian/dhclient-script.linux.udeb b/debian/dhclient-script.linux.udeb
index 4028b2e..505b035 100644
--- a/debian/dhclient-script.linux.udeb
+++ b/debian/dhclient-script.linux.udeb
@@ -10,17 +10,22 @@ set -e
# Updated for Linux 2.[12] by Brian J. Murrell, January 1999.
# Modified for Debian. Matt Zimmerman and Eloy Paris, December 2003
+# update /etc/resolv.conf based on received values
make_resolv_conf() {
local new_resolv_conf
+
if [ -n "$new_domain_name" ] || [ -n "$new_domain_name_servers" ]; then
new_resolv_conf=/etc/resolv.conf.dhclient-new
rm -f $new_resolv_conf
+
if [ -n "$new_domain_name" ]; then
echo "search $new_domain_name" >>$new_resolv_conf
fi
+
for nameserver in $new_domain_name_servers; do
echo "nameserver $nameserver" >>$new_resolv_conf
done
+
mv $new_resolv_conf /etc/resolv.conf
fi
}
@@ -28,11 +33,13 @@ make_resolv_conf() {
set_hostname() {
local current_hostname
current_hostname=$(cat /proc/sys/kernel/hostname)
+
if [ -z "$current_hostname" ] || [ "$current_hostname" = "(none)" ]; then
echo "$new_host_name" > /proc/sys/kernel/hostname
fi
}
+# set up some variables for DHCP handlers below
if [ -n "$new_subnet_mask" ]; then
new_mask="/$(ptom $new_subnet_mask)"
fi
@@ -57,9 +64,10 @@ case "$reason" in
# We need to give the kernel some time to get the interface up.
sleep 1
+
;;
- BOUND|RENEW|REBIND|REBOOT)
+ BOUND|RENEW|REBIND|REBOOT)
set_hostname
if [ -n "$old_ip_address" ] &&
--
ISC DHCP packaging for Debian
More information about the pkg-dhcp-commits
mailing list