r2855 - in trunk/bootscripts: . blfs/sysconfig/network-devices/services

dj at linuxfromscratch.org dj at linuxfromscratch.org
Wed Oct 20 21:00:49 PDT 2004


Author: dj
Date: 2004-10-20 22:00:48 -0600 (Wed, 20 Oct 2004)
New Revision: 2855

Modified:
   trunk/bootscripts/ChangeLog
   trunk/bootscripts/blfs/sysconfig/network-devices/services/dhcpcd
Log:
Added PRINTIP and PRINTALL to dhcpcd service script

Modified: trunk/bootscripts/ChangeLog
===================================================================
--- trunk/bootscripts/ChangeLog	2004-10-20 21:03:59 UTC (rev 2854)
+++ trunk/bootscripts/ChangeLog	2004-10-21 04:00:48 UTC (rev 2855)
@@ -1,3 +1,7 @@
+2004-10-20 DJ Lucas <dj at linuxfromscratch.org>
+	* Added ability to print assigned addresses when using
+	  dhcpcd service script.
+
 2004-10-13 Igor Zivkovic <igor at linuxfromscratch.org>
 	* Added ntpd -gqx to ntp bootscript start case to set
 	  the initial time (Thomas Trepl)

Modified: trunk/bootscripts/blfs/sysconfig/network-devices/services/dhcpcd
===================================================================
--- trunk/bootscripts/blfs/sysconfig/network-devices/services/dhcpcd	2004-10-20 21:03:59 UTC (rev 2854)
+++ trunk/bootscripts/blfs/sysconfig/network-devices/services/dhcpcd	2004-10-21 04:00:48 UTC (rev 2855)
@@ -17,7 +17,7 @@
 
 case "$2" in
         up)
-                echo "Starting dhcpcd on the $1 interface..."
+                echo -n "Starting dhcpcd on the $1 interface..."
                 # Test to see if there is a stale pid file
                 if [ -f "$PIDFILE" ]
                 then
@@ -31,7 +31,28 @@
                     fi
                 fi
                 /sbin/dhcpcd $1 $DHCP_START
-                evaluate_retval
+		# Save the return value
+		RET="$?"
+		# Print the assigned settings if requested
+		if [ "$RET" == "0" -a "$PRINTIP" == "yes" ]; then
+			. /var/lib/dhcpc/dhcpcd-$1.info
+			if [ "$PRINTALL" == "yes" ]; then
+				echo ""
+				print_status success
+				echo "           DHCP Assigned Settings for $1:"
+				echo "           IP Address:      $IPADDR"
+				echo "           Subnet Mask:     $NETMASK"
+				echo "           Default Gateway: $GATEWAY"
+				echo "           DNS Server:      $DNS"
+			else
+				echo " IP Addresss: ""$IPADDR""..."
+				print_status success
+			fi
+		else
+			echo ""
+			$(exit "$RET")
+			evaluate_retval
+		fi
         ;;
                                                                                 
         down)




More information about the blfs-book mailing list