r6326 - trunk/bootscripts/blfs/sysconfig/network-devices/services

dnicholson at linuxfromscratch.org dnicholson at linuxfromscratch.org
Sun Oct 1 11:04:37 PDT 2006


Author: dnicholson
Date: 2006-10-01 12:04:35 -0600 (Sun, 01 Oct 2006)
New Revision: 6326

Modified:
   trunk/bootscripts/blfs/sysconfig/network-devices/services/dhclient
   trunk/bootscripts/blfs/sysconfig/network-devices/services/dhcpcd
Log:
Consistent use of tabs in dhclient network script.


Modified: trunk/bootscripts/blfs/sysconfig/network-devices/services/dhclient
===================================================================
--- trunk/bootscripts/blfs/sysconfig/network-devices/services/dhclient	2006-10-01 17:39:12 UTC (rev 6325)
+++ trunk/bootscripts/blfs/sysconfig/network-devices/services/dhclient	2006-10-01 18:04:35 UTC (rev 6326)
@@ -19,13 +19,13 @@
 }
 
 case "$2" in
-        up)
-                boot_mesg "Starting dhclient on the $1 interface..."
-                /sbin/dhclient $1 $DHCP_START
-                # Save the return value
-                RET="$?"
-                # Print the assigned settings if requested
-                if [ "$RET" = "0" -a "$PRINTIP" = "yes" ]; then
+	up)
+		boot_mesg "Starting dhclient on the $1 interface..."
+		/sbin/dhclient $1 $DHCP_START
+		# Save the return value
+		RET="$?"
+		# Print the assigned settings if requested
+		if [ "$RET" = "0" -a "$PRINTIP" = "yes" ]; then
 			# Get info from dhclient.leases file
 			IPADDR=`getipstats | grep "fixed-address" | \
 				sed 's/ fixed-address //' | \
@@ -40,47 +40,47 @@
 				sed 's/ option domain-name-servers //' | \
 				sed 's/\;//' | sed 's/,/ and /'`
 
-                        if [ "$PRINTALL" = "yes" ]; then
-                                $(exit "$RET")
+			if [ "$PRINTALL" = "yes" ]; then
+				$(exit "$RET")
 				evaluate_retval
-                                boot_mesg "           DHCP Assigned Settings for $1:"
+				boot_mesg "           DHCP Assigned Settings for $1:"
 				boot_mesg_flush
-                                boot_mesg "           IP Address:      $IPADDR"
+				boot_mesg "           IP Address:      $IPADDR"
 				boot_mesg_flush
-                                boot_mesg "           Subnet Mask:     $NETMASK"
+				boot_mesg "           Subnet Mask:     $NETMASK"
 				boot_mesg_flush
-                                boot_mesg "           Default Gateway: $GATEWAY"
+				boot_mesg "           Default Gateway: $GATEWAY"
 				boot_mesg_flush
-                                boot_mesg "           DNS Server:      $DNS"
+				boot_mesg "           DNS Server:      $DNS"
 				boot_mesg_flush
-                        else
-                                boot_mesg " IP Addresss:""$IPADDR"
-                                $(exit "$RET")
+			else
+				boot_mesg " IP Addresss:""$IPADDR"
+				$(exit "$RET")
 				evaluate_retval
-                        fi
-                else
-                        $(exit "$RET")
-                        evaluate_retval
-                fi
-        ;;
+			fi
+		else
+			$(exit "$RET")
+			evaluate_retval
+		fi
+	;;
 
-        down)
-                boot_mesg "Stoping dhclient on the $1 interface..."
+	down)
+		boot_mesg "Stoping dhclient on the $1 interface..."
 		if [ "$DHCP_STOP" = "" ]
 		then
 			# This breaks multiple interfaces please provide
 			# the correct stop arguments.
 			killproc dhclient
 		else
-                	/sbin/dhclient $1 $DHCP_STOP
-                	evaluate_retval
+			/sbin/dhclient $1 $DHCP_STOP
+			evaluate_retval
 		fi
-        ;;
+	;;
 
-        *)
-                echo "Usage: $0 [interface] {up|down}"
-                exit 1
-        ;;
+	*)
+		echo "Usage: $0 [interface] {up|down}"
+		exit 1
+	;;
 esac
 
 # End $network_devices/services/dhclient

Modified: trunk/bootscripts/blfs/sysconfig/network-devices/services/dhcpcd
===================================================================
--- trunk/bootscripts/blfs/sysconfig/network-devices/services/dhcpcd	2006-10-01 17:39:12 UTC (rev 6325)
+++ trunk/bootscripts/blfs/sysconfig/network-devices/services/dhcpcd	2006-10-01 18:04:35 UTC (rev 6326)
@@ -4,6 +4,7 @@
 # Based upon lfs-bootscripts-1.12 $network_devices/if{down,up}
 # Rewritten by Nathan Coulson <nathan at linuxfromscratch.org>
 # Adapted for dhcpcd by DJ Lucas <dj at lucasit.com>
+# Modified by Brian Weber to handle an absent carrier on an interface.
 
 #$LastChangedBy$
 #$Date$
@@ -17,6 +18,13 @@
 
 case "$2" in
 	up)
+		# Abort startup and issue a warning if interface lacks a carrier
+		if [ "`/sbin/ip link show $1 2>/dev/null | grep NO-CARRIER`" ]
+		then
+			boot_mesg "$1 lacks carrier. Skipping dhcp setup." ${WARNING}
+			echo_warning
+			exit 0
+		fi
 		boot_mesg -n "Starting dhcpcd on the $1 interface..."
 		# Test to see if there is a stale pid file
 		if [ -f "$PIDFILE" ]




More information about the blfs-book mailing list