[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:08 UTC 2011
The following commit has been merged in the master branch:
commit dc7af7a4d7f93a2d52e34b53319e4eed658994ce
Author: Peter Marschall <peter at adpm.de>
Date: Sat Jan 8 13:40:23 2011 +0100
dhclient-script:* remove bashisms
Prepare for dhclient-script to be used without bash.
Further work is required in the hook scripts
Signed-off-by: Peter Marschall <peter at adpm.de>
diff --git a/debian/dhclient-script.kfreebsd b/debian/dhclient-script.kfreebsd
index c3cd259..ea03628 100644
--- a/debian/dhclient-script.kfreebsd
+++ b/debian/dhclient-script.kfreebsd
@@ -3,8 +3,9 @@
# Based on Linux and FreeBSD scripts.
make_resolv_conf() {
- if [ -n "$new_domain_name" -o -n "$new_domain_name_servers" ]; then
- local new_resolv_conf=/etc/resolv.conf.dhclient-new
+ 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 domain ${new_domain_name%% *} >>$new_resolv_conf
@@ -32,8 +33,9 @@ make_resolv_conf() {
}
run_hook() {
- local script="$1"
+ local script
local exit_status
+ script="$1"
shift # discard the first argument, then the rest are the script's
if [ -f $script ]; then
@@ -50,8 +52,9 @@ run_hook() {
}
run_hookdir() {
- local dir="$1"
+ local dir
local exit_status
+ dir="$1"
shift # See run_hook
if [ -d "$dir" ]; then
@@ -129,19 +132,19 @@ case "$reason" in
;;
BOUND|RENEW|REBIND|REBOOT)
- if [ -n "$old_host_name" -a -n "$host_name" -a \
- "$host_name" != "$old_host_name" ]; then
+ if [ -n "$old_host_name" ] && [ -n "$host_name" ] &&
+ [ "$host_name" != "$old_host_name" ]; then
hostname "$new_host_name"
fi
- if [ -n "$old_ip_address" -a -n "$alias_ip_address" -a \
- "$alias_ip_address" != "$old_ip_address" ]; then
+ if [ -n "$old_ip_address" ] && [ -n "$alias_ip_address" ] &&
+ [ "$alias_ip_address" != "$old_ip_address" ]; then
# Possible new alias. Remove old alias.
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" -a \
- "$old_ip_address" != "$new_ip_address" ]; then
+ if [ -n "$old_ip_address" ] &&
+ [ "$old_ip_address" != "$new_ip_address" ]; then
ifconfig $interface inet -alias $old_ip_address $medium
route delete $old_ip_address 127.1 >/dev/null 2>&1
# IP address changed. Bringing down the interface will delete all other
@@ -150,14 +153,15 @@ case "$reason" in
fi
# point to point
- if [ "$new_subnet_mask" == "255.255.255.255" ]; then
+ if [ "$new_subnet_mask" = "255.255.255.255" ]; then
for router in $new_routers; do
route add $router $new_ip_address
done
fi
- if [ -z "$old_ip_address" -o "$old_ip_address" != "$new_ip_address" -o \
- "$reason" = "BOUND" -o "$reason" = "REBOOT" ]; then
+ 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
@@ -174,8 +178,8 @@ case "$reason" in
fi
fi
- if [ "$new_ip_address" != "$alias_ip_address" -a -n "$alias_ip_address" ];
- then
+ if [ -n "$alias_ip_address" ] &&
+ [ "$new_ip_address" != "$alias_ip_address" ]; then
ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
route add $alias_ip_address 127.0.0.1
fi
@@ -218,8 +222,8 @@ case "$reason" in
first_router="$1"
if [ -z "$first_router" ] || ping -q -c 1 $first_router; then
- if [ "$new_ip_address" != "$alias_ip_address" -a \
- -n "$alias_ip_address" ]; then
+ if [ -n "$alias_ip_address" ] &&
+ [ "$new_ip_address" != "$alias_ip_address" ]; then
ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
route add $alias_ip_address 127.0.0.1
fi
diff --git a/debian/dhclient-script.kfreebsd.udeb b/debian/dhclient-script.kfreebsd.udeb
index 3347539..73f556d 100644
--- a/debian/dhclient-script.kfreebsd.udeb
+++ b/debian/dhclient-script.kfreebsd.udeb
@@ -11,8 +11,9 @@ set -e
# Modified for Debian. Matt Zimmerman and Eloy Paris, December 2003
make_resolv_conf() {
+ local new_resolv_conf
if [ -n "$new_domain_name" ] || [ -n "$new_domain_name_servers" ]; then
- local new_resolv_conf=/etc/resolv.conf.dhclient-new
+ 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
@@ -25,7 +26,8 @@ make_resolv_conf() {
}
set_hostname() {
- local current_hostname=$(hostname)
+ local current_hostname
+ current_hostname=$(hostname)
if [ -z "$current_hostname" ] || [ "$current_hostname" = "(none)" ]; then
hostname "$new_host_name"
fi
@@ -61,8 +63,8 @@ case "$reason" in
set_hostname
- if [ -n "$old_ip_address" ] && \
- [ "$old_ip_address" != "$new_ip_address" ]; then
+ if [ -n "$old_ip_address" ] &&
+ [ "$old_ip_address" != "$new_ip_address" ]; then
# IP address changed. Bringing down the interface will delete all routes,
# and clear the ARP cache.
ifconfig $interface inet -alias $old_ip_address $medium
@@ -74,8 +76,9 @@ case "$reason" in
ifconfig $interface mtu $new_interface_mtu || true
fi
- if [ -z "$old_ip_address" ] || [ "$old_ip_address" != "$new_ip_address" ] || \
- [ "$reason" = "BOUND" ] || [ "$reason" = "REBOOT" ]; then
+ 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
diff --git a/debian/dhclient-script.linux b/debian/dhclient-script.linux
index 21ee7c1..d065140 100644
--- a/debian/dhclient-script.linux
+++ b/debian/dhclient-script.linux
@@ -13,8 +13,9 @@
# The alias handling in here probably still sucks. -mdz
make_resolv_conf() {
- if [ "$new_domain_name" -o "$new_domain_name_servers" ]; then
- local new_resolv_conf=/etc/resolv.conf.dhclient-new
+ local new_resolv_conf
+ if [ "$new_domain_name" ] || [ "$new_domain_name_servers" ]; then
+ new_resolv_conf=/etc/resolv.conf.dhclient-new
rm -f $new_resolv_conf
if [ "$new_domain_name" ]; then
echo domain ${new_domain_name%% *} >>$new_resolv_conf
@@ -51,8 +52,9 @@ make_resolv_conf() {
}
run_hook() {
- local script="$1"
+ local script
local exit_status
+ script="$1"
shift # discard the first argument, then the rest are the script's
if [ -f $script ]; then
@@ -69,8 +71,9 @@ run_hook() {
}
run_hookdir() {
- local dir="$1"
+ local dir
local exit_status
+ dir="$1"
shift # See run_hook
if [ -d "$dir" ]; then
@@ -153,33 +156,34 @@ case "$reason" in
;;
BOUND|RENEW|REBIND|REBOOT)
- if [ -n "$old_host_name" -a -n "$host_name" -a \
- "$host_name" != "$old_host_name" ]; then
+ if [ -n "$old_host_name" ] && [ -n "$host_name" ] &&
+ [ "$host_name" != "$old_host_name" ]; then
hostname "$new_host_name"
fi
- if [ -n "$old_ip_address" -a -n "$alias_ip_address" -a \
- "$alias_ip_address" != "$old_ip_address" ]; then
+ if [ -n "$old_ip_address" ] && [ -n "$alias_ip_address" ] &&
+ [ "$alias_ip_address" != "$old_ip_address" ]; then
# Possible new alias. Remove old alias.
ifconfig $interface:0- inet 0
fi
- if [ -n "$old_ip_address" -a \
- "$old_ip_address" != "$new_ip_address" ]; then
+ if [ -n "$old_ip_address" ] &&
+ [ "$old_ip_address" != "$new_ip_address" ]; then
# 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" -o "$old_ip_address" != "$new_ip_address" -o \
- "$reason" = "BOUND" -o "$reason" = "REBOOT" ]; then
+ 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
# point to point
- if [ "$new_subnet_mask" == "255.255.255.255" ]; then
+ if [ "$new_subnet_mask" = "255.255.255.255" ]; then
for router in $new_routers; do
route add -host $router dev $interface
done
@@ -190,8 +194,8 @@ case "$reason" in
done
fi
- if [ "$new_ip_address" != "$alias_ip_address" -a -n "$alias_ip_address" ];
- then
+ if [ -n "$alias_ip_address" ] &&
+ [ "$new_ip_address" != "$alias_ip_address" ]; then
ifconfig $interface:0- inet 0
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
route add -host $alias_ip_address $interface:0
@@ -231,8 +235,8 @@ case "$reason" in
first_router="$1"
if [ -z "$first_router" ] || ping -q -c 1 $first_router; then
- if [ "$new_ip_address" != "$alias_ip_address" -a \
- -n "$alias_ip_address" ]; then
+ if [ -n "$alias_ip_address" ] &&
+ [ "$new_ip_address" != "$alias_ip_address" ]; then
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
route add -host $alias_ip_address dev $interface:0
fi
diff --git a/debian/dhclient-script.linux.udeb b/debian/dhclient-script.linux.udeb
index e42a55f..4028b2e 100644
--- a/debian/dhclient-script.linux.udeb
+++ b/debian/dhclient-script.linux.udeb
@@ -11,8 +11,9 @@ set -e
# Modified for Debian. Matt Zimmerman and Eloy Paris, December 2003
make_resolv_conf() {
+ local new_resolv_conf
if [ -n "$new_domain_name" ] || [ -n "$new_domain_name_servers" ]; then
- local new_resolv_conf=/etc/resolv.conf.dhclient-new
+ 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
@@ -25,7 +26,8 @@ make_resolv_conf() {
}
set_hostname() {
- local current_hostname=$(cat /proc/sys/kernel/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
@@ -60,8 +62,8 @@ case "$reason" in
set_hostname
- if [ -n "$old_ip_address" ] && \
- [ "$old_ip_address" != "$new_ip_address" ]; then
+ if [ -n "$old_ip_address" ] &&
+ [ "$old_ip_address" != "$new_ip_address" ]; then
# IP address changed. Bringing down the interface will delete all routes,
# and clear the ARP cache.
ip addr del $old_ip_address$old_mask $old_broadcast_arg dev $interface
@@ -72,8 +74,9 @@ case "$reason" in
ip link set $interface mtu $new_interface_mtu || true
fi
- if [ -z "$old_ip_address" ] || [ "$old_ip_address" != "$new_ip_address" ] || \
- [ "$reason" = "BOUND" ] || [ "$reason" = "REBOOT" ]; then
+ if [ -z "$old_ip_address" ] ||
+ [ "$old_ip_address" != "$new_ip_address" ] ||
+ [ "$reason" = "BOUND" ] || [ "$reason" = "REBOOT" ]; then
ip link set $interface up
ip addr flush dev $interface
--
ISC DHCP packaging for Debian
More information about the pkg-dhcp-commits
mailing list