r7585 - trunk/bootscripts/contrib/lsb-v3/sysconfig/network-devices/services

dj at linuxfromscratch.org dj at linuxfromscratch.org
Sun Sep 7 10:02:34 PDT 2008


Author: dj
Date: 2008-09-07 11:02:34 -0600 (Sun, 07 Sep 2008)
New Revision: 7585

Added:
   trunk/bootscripts/contrib/lsb-v3/sysconfig/network-devices/services/dhcpcd
Log:
put dhcpcd service script back

Added: trunk/bootscripts/contrib/lsb-v3/sysconfig/network-devices/services/dhcpcd
===================================================================
--- trunk/bootscripts/contrib/lsb-v3/sysconfig/network-devices/services/dhcpcd	                        (rev 0)
+++ trunk/bootscripts/contrib/lsb-v3/sysconfig/network-devices/services/dhcpcd	2008-09-07 17:02:34 UTC (rev 7585)
@@ -0,0 +1,83 @@
+#!/bin/sh
+# Begin $network-devices/services/dhcpcd
+
+# 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>
+
+#$LastChangedBy: bdubbs $
+#$Date: 2005-08-01 13:29:19 -0600 (Mon, 01 Aug 2005) $
+
+#. /etc/sysconfig/rc
+#. $RC_FUNCTIONS
+
+. /lib/lsb/init-functions
+. $IFCONFIG
+
+PIDFILE="/var/run/dhcpcd-$1.pid"
+LEASEINFO="/var/lib/dhcpcd/dhcpcd-$1.info"
+
+case "$2" in
+        up)
+                message="Starting dhcpcd on the $1 interface..."
+                # Test to see if there is a stale pid file
+                if [ -f "$PIDFILE" ]
+                then
+                    ps `cat "$PIDFILE"` | grep dhcpcd > /dev/null
+                    if [ $? != 0 ]
+                    then
+                        rm -f /var/run/dhcpcd-$1.pid > /dev/null
+                    else
+			message="${message}dhcpcd already running!"
+                        log_warning_msg "${message}"
+                        exit 2
+                    fi
+                fi
+                /sbin/dhcpcd $1 $DHCP_START
+		# Save the return value
+                RET="${?}"
+                ( exit "${RET}"; )
+                evaluate_retval standard
+		# Print the assigned settings if requested
+		if [ "$RET" = "0" -a "$PRINTIP" = "yes" ]; then
+			. "$LEASEINFO"
+			if [ "$PRINTALL" = "yes" ]; then
+				echo "           DHCP Assigned Settings for $1:"
+				echo "           IP Address:      $IPADDR"
+				echo "           Subnet Mask:     $NETMASK"
+				echo "           Default Gateway: $GATEWAYS"
+				echo "           DNS Server:      $DNSSERVERS"
+			else
+				echo " IP Addresss: ""$IPADDR"
+			fi
+                fi
+        ;;
+
+        down)
+		message="Stopping dhcpcd on the $1 interface..."
+		if [ -z "$DHCP_STOP" ]
+		then
+		    killproc -p "${PIDFILE}" /sbin/dhcpcd
+		    evaluate_retval standard
+		else
+		    /sbin/dhcpcd $1 $DHCP_STOP &> /dev/null
+		    RET="$?"
+		    if [ "$RET" -eq 0 ]; then
+			echo -n ""
+			evaluate_retval standard
+		    elif [ "$RET" -eq 1 ]; then
+			message="${message}dhcpcd not running!"
+			log_warning_msg "${message}"
+		    else
+			log_failure_msg "${message}"
+		    fi
+		fi
+        ;;
+
+        *)
+                echo "Usage: $0 [interface] {up|down}"
+                exit 1
+        ;;
+esac
+
+# End $NETWORK_DEVICES/services/dhcpcd




More information about the blfs-book mailing list