]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
- be sure that dhcp client detection is same for ifup and ifdown
authorElan Ruusamäe <glen@pld-linux.org>
Mon, 22 Jan 2007 19:10:05 +0000 (19:10 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Mon, 22 Jan 2007 19:10:05 +0000 (19:10 +0000)
svn-id: @8192

sysconfig/network-scripts/functions.network
sysconfig/network-scripts/ifdown
sysconfig/network-scripts/ifup

index 681c4233b8562f7fefc3125cd39a8950010d287f..689166e9611f1fa29817b6d9d8ba663317ea2356 100644 (file)
@@ -75,6 +75,28 @@ set_hostname()
        fi
 }
 
+set_dhcpclient()
+{
+       if [ "$BOOTPROTO" = "bootp" -o "$BOOTPROTO" = "pump" ]; then
+               DHCP_CLIENT=/sbin/pump
+       fi
+
+       if [ -z "$DHCP_CLIENT" ]; then
+               if [ -x /sbin/dhcpcd ]; then
+                       DHCP_CLIENT=/sbin/dhcpcd
+               elif [ -x /sbin/dhclient ]; then
+                       DHCP_CLIENT=/sbin/dhclient
+               elif [ -x /sbin/dhcpxd ]; then
+                       DHCP_CLIENT=/sbin/dhcpxd
+               elif [ -x /sbin/pump ]; then
+                       DHCP_CLIENT=/sbin/pump
+               else
+                       nls "Can't find a dhcp client."
+                       exit 1
+               fi
+       fi
+}
+
 # Setup Network Address Translation (NAT)
 setup_nat()
 {
index 1233c3a324af7330c7ed1ba4a53786d7e5eb0ccc..076a6340dee907559d715de0f323975b864d0fc9 100755 (executable)
@@ -59,31 +59,36 @@ if [ -x $OTHERSCRIPT ]; then
        fi
 fi
 
-if [ "$BOOTPROTO" = "bootp" -o "$BOOTPROTO" = "pump" ]; then
-       /sbin/pump -r -i ${DEVICE}
-       RESULT=$?
-fi
-
-if [ "$BOOTPROTO" = "dhcp" ]; then
-       if [ -x /sbin/dhcpcd ];then
-               /sbin/dhcpcd -k ${DEVICE}
-               RESULT=$?
-       elif [ -x /sbin/dhclient ];then
-               if [ -f /var/run/dhclient.pid ];then
-                       PID=$(cat /var/run/dhclient.pid)
-                       if ps ax --no-header|grep -q $PID;then
-                               kill $PID
-                               RESULT=$?
+if [ -n "$BOOTPROTO" -a "$BOOTPROTO" != "none" -a "$BOOTPROTO" != "static" ]; then
+       if is_yes "$IPV4_NETWORKING"; then
+               set_dhcpclient
+
+               case ${DHCP_CLIENT##*/} in
+                 pump)
+                       /sbin/pump -r -i ${DEVICE}
+                       RESULT=$?
+                       ;;
+                 dhcpcd)
+                       /sbin/dhcpcd -k ${DEVICE}
+                       RESULT=$?
+                       ;;
+                 dhcpxd)
+                       /sbin/dhcpxd -k ${DEVICE}
+                       RESULT=$?
+                       ;;
+                 dhclient)
+                       if [ -f /var/run/dhclient.pid ];then
+                               PID=$(cat /var/run/dhclient.pid)
+                               if ps ax --no-header | grep -q $PID; then
+                                       kill $PID
+                                       RESULT=$?
+                               fi
                        fi
-               fi
-       elif [ -x /sbin/dhcpxd ];then
-               /sbin/dhcpxd -k ${DEVICE}
-               RESULT=$?
-       elif [ -x /sbin/pump ];then
-               pump -r -i ${DEVICE}
-               RESULT=$?
+                       ;;
+               esac
+
+               sleep 1 # WHY?
        fi
-       sleep 1
 fi
 
 if is_wireless_device "${DEVICE}"; then
index 90b2de90d46763db350fa02893d7e4beb730cdd1..ef8ad68495ae57fcf16c36b19e1c39e4afe2dae5 100755 (executable)
@@ -119,24 +119,7 @@ fi
 
 if [ -n "$BOOTPROTO" -a "$BOOTPROTO" != "none" -a "$BOOTPROTO" != "static" ]; then
        if is_yes "$IPV4_NETWORKING"; then
-               if [ "$BOOTPROTO" = "bootp" -o "$BOOTPROTO" = "pump" ]; then
-                       DHCP_CLIENT=/sbin/pump
-               fi
-
-               if [ -z "$DHCP_CLIENT" ]; then
-                       if [ -x /sbin/dhcpcd ]; then
-                               DHCP_CLIENT=/sbin/dhcpcd
-                       elif [ -x /sbin/dhclient ]; then
-                               DHCP_CLIENT=/sbin/dhclient
-                       elif [ -x /sbin/dhcpxd ]; then
-                               DHCP_CLIENT=/sbin/dhcpxd
-                       elif [ -x /sbin/pump ]; then
-                               DHCP_CLIENT=/sbin/pump
-                       else
-                               nls "Can't find a dhcp client."
-                               exit 1
-                       fi
-               fi
+               set_dhcpclient
 
                DHCP_ARGS=
                if [ -n "$DHCP_CLIENT" ]; then
This page took 0.044565 seconds and 4 git commands to generate.