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

dj at linuxfromscratch.org dj at linuxfromscratch.org
Thu Jun 23 22:16:14 PDT 2005


Author: dj
Date: 2005-06-23 23:16:14 -0600 (Thu, 23 Jun 2005)
New Revision: 4654

Modified:
   trunk/bootscripts/blfs/sysconfig/network-devices/services/dhclient
   trunk/bootscripts/blfs/sysconfig/network-devices/services/dhcpcd
   trunk/bootscripts/blfs/sysconfig/network-devices/services/ipx
   trunk/bootscripts/blfs/sysconfig/network-devices/services/pppoe
Log:
network service scripts updated to use new functions

Modified: trunk/bootscripts/blfs/sysconfig/network-devices/services/dhclient
===================================================================
--- trunk/bootscripts/blfs/sysconfig/network-devices/services/dhclient	2005-06-23 15:50:52 UTC (rev 4653)
+++ trunk/bootscripts/blfs/sysconfig/network-devices/services/dhclient	2005-06-24 05:16:14 UTC (rev 4654)
@@ -12,7 +12,7 @@
 . $rc_functions
 . $IFCONFIG
 
-printstats()
+getipstats()
 {
 	# Print the last 16 lines of dhclient.leases
 	sed -e :a -e '$q;N;17,$D;ba' /var/state/dhcp//dhclient.leases
@@ -20,47 +20,52 @@
 
 case "$2" in
         up)
-                echo "Starting dhclient on the interface..."
+                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=`printstats | grep "fixed-address" | \
+			IPADDR=`getipstats | grep "fixed-address" | \
 				sed 's/ fixed-address //' | \
 				sed 's/\;//'`
-			NETMASK=`printstats | grep "subnet-mask" | \
+			NETMASK=`getipstats | grep "subnet-mask" | \
 				sed 's/ option subnet-mask //' | \
 				sed 's/\;//'`
-			GATEWAY=`printstats | grep "routers" | \
+			GATEWAY=`getipstats | grep "routers" | \
 				sed 's/ option routers //' | \
 				sed 's/\;//'`
-			DNS=`printstats | grep "domain-name-servers" | \
+			DNS=`getipstats | grep "domain-name-servers" | \
 				sed 's/ option domain-name-servers //' | \
 				sed 's/\;//' | sed 's/,/ and /'`
 
                         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"
+                                $(exit "$RET")
+				evaluate_retval
+                                boot_mesg "           DHCP Assigned Settings for $1:"
+				boot_mesg_flush
+                                boot_mesg "           IP Address:      $IPADDR"
+				boot_mesg_flush
+                                boot_mesg "           Subnet Mask:     $NETMASK"
+				boot_mesg_flush
+                                boot_mesg "           Default Gateway: $GATEWAY"
+				boot_mesg_flush
+                                boot_mesg "           DNS Server:      $DNS"
+				boot_mesg_flush
                         else
-                                echo " IP Addresss:""$IPADDR"
-                                print_status success
+                                boot_mesg " IP Addresss:""$IPADDR"
+                                $(exit "$RET")
+				evaluate_retval
                         fi
                 else
-                        echo ""
                         $(exit "$RET")
                         evaluate_retval
                 fi
         ;;
 
         down)
-                echo "Stoping dhclient on the $1 interface..."
+                boot_mesg "Stoping dhclient on the $1 interface..."
 		if [ "$DHCP_STOP" == "" ]
 		then
 			# This breaks multiple interfaces please provide

Modified: trunk/bootscripts/blfs/sysconfig/network-devices/services/dhcpcd
===================================================================
--- trunk/bootscripts/blfs/sysconfig/network-devices/services/dhcpcd	2005-06-23 15:50:52 UTC (rev 4653)
+++ trunk/bootscripts/blfs/sysconfig/network-devices/services/dhcpcd	2005-06-24 05:16:14 UTC (rev 4654)
@@ -17,7 +17,7 @@
 
 case "$2" in
         up)
-                echo -n "Starting dhcpcd on the $1 interface..."
+                boot_mesg -n "Starting dhcpcd on the $1 interface..."
                 # Test to see if there is a stale pid file
                 if [ -f "$PIDFILE" ]
                 then
@@ -26,7 +26,8 @@
                     then
                         rm -f /var/run/dhcpcd-$1.pid > /dev/null
                     else
-                        print_status warning running
+			boot_mesg "dhcpcd already running!" ${WARNING}
+                        echo_warning
                         exit 2
                     fi
                 fi
@@ -38,15 +39,20 @@
 			. /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"
+				echo_ok
+				boot_mesg "           DHCP Assigned Settings for $1:"
+				boot_mesg_flush
+				boot_mesg "           IP Address:      $IPADDR"
+				boot_mesg_flush
+				boot_mesg "           Subnet Mask:     $NETMASK"
+				boot_mesg_flush
+				boot_mesg "           Default Gateway: $GATEWAY"
+				boot_mesg_flush
+				boot_mesg "           DNS Server:      $DNS"
+				boot_mesg_flush
 			else
-				echo " IP Addresss: ""$IPADDR"
-				print_status success
+				boot_mesg " IP Addresss: ""$IPADDR"
+				echo_ok
 			fi
 		else
 			echo ""
@@ -56,7 +62,7 @@
         ;;
 
         down)
-		echo "Stopping dhcpcd on the $1 interface..."
+		boot_mesg -n "Stopping dhcpcd on the $1 interface..."
 		# Do nothing with the client daemon if we have an infinate 
 		# lease time as the client exits when started in this case,
 		# just echo OK.
@@ -67,19 +73,32 @@
 		    if [ "$LEASETIME" = "4294967295" ]
 		    then
 			# do nothing, just echo ok
-			print_status ok
+			echo ""
+			echo_ok
 		    else
-			if [ -z "$DHCP_STOP" ]
+			if [ -n "$DHCP_STOP" ]
 			then
+			    /sbin/dhcpcd $1 $DHCP_STOP &> /dev/null
+			    RET="$?"
+			    if [ "$RET" -eq 0 ]; then
+				echo ""
+				echo_ok
+			    elif [ "$RET" -eq 1 ]; then
+				boot_mesg "dhcpcd not running!" ${WARNING}
+				echo_warning
+			    else
+				echo ""
+				echo_failure
+			    fi
+			else
+			    echo ""
 			    killproc dhcpcd
-			else
-			    /sbin/dhcpcd $1 $DHCP_STOP
-			    evaluate_retval
 			fi
 		    fi
 		else
-		    echo "LEASEINFO Test failed"
-		    print_status warning not_running
+		    boot_mesg -n "LEASEINFO Test failed! - " ${WARNING}
+		    boot_mesg "dhcpcd is not running!" ${WARNING}
+		    echo_warning
 		    exit 1
 		fi
         ;;

Modified: trunk/bootscripts/blfs/sysconfig/network-devices/services/ipx
===================================================================
--- trunk/bootscripts/blfs/sysconfig/network-devices/services/ipx	2005-06-23 15:50:52 UTC (rev 4653)
+++ trunk/bootscripts/blfs/sysconfig/network-devices/services/ipx	2005-06-24 05:16:14 UTC (rev 4654)
@@ -14,14 +14,14 @@
 
 case $2 in
         up)
-                echo "Starting IPX on the $1 interface..."
+                boot_mesg "Starting IPX on the $1 interface..."
                 /bin/ipx_interface add $1 $FRAME &&
                 /bin/ipx_configure --auto_interface=on --auto_primary=on
                 evaluate_retval
         ;;
 
         down)
-                echo "Stopping IPX on the $1 interface..."
+                boot_mesg "Stopping IPX on the $1 interface..."
                 /bin/ipx_configure --auto_interface=off --auto_primary=off &&
                 /bin/ipx_interface del $1 $FRAME
                 evaluate_retval

Modified: trunk/bootscripts/blfs/sysconfig/network-devices/services/pppoe
===================================================================
--- trunk/bootscripts/blfs/sysconfig/network-devices/services/pppoe	2005-06-23 15:50:52 UTC (rev 4653)
+++ trunk/bootscripts/blfs/sysconfig/network-devices/services/pppoe	2005-06-24 05:16:14 UTC (rev 4654)
@@ -13,13 +13,13 @@
 
 case "$2" in
         up)
-                echo "Bringing up the ADSL interface..."
+                boot_mesg "Bringing up the ADSL interface..."
                 /usr/sbin/adsl-start
                 evaluate_retval
         ;;
 
         down)
-                echo "Bringing down the ADSL interface..."
+                boot_mesg "Bringing down the ADSL interface..."
                 /usr/sbin/adsl-stop
                 evaluate_retval
         ;;




More information about the blfs-book mailing list