diff options
author | William Harrington <kb0iic@berzerkula.org> | 2014-03-05 13:16:40 -0600 |
---|---|---|
committer | William Harrington <kb0iic@berzerkula.org> | 2014-03-05 13:16:40 -0600 |
commit | d3078b183348e703cf5928128d2706c31fc7d870 (patch) | |
tree | d63a12e38bbf721d79d3181351e1efc1bfc22af9 /clfs/services/dhcpcd |
Initial commit.
Diffstat (limited to 'clfs/services/dhcpcd')
-rw-r--r-- | clfs/services/dhcpcd | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/clfs/services/dhcpcd b/clfs/services/dhcpcd new file mode 100644 index 0000000..0408df1 --- /dev/null +++ b/clfs/services/dhcpcd @@ -0,0 +1,69 @@ +#!/bin/bash +# Begin services/dhcpcd + +# Origianlly dased upon lfs-bootscripts-1.12 $NETWORK_DEVICES/if{down,up} +# Rewritten by Nathan Coulson <nathan@linuxfromscratch.org> +# Adapted for dhcpcd by DJ Lucas <dj@linuxfromscratch.org> +# Update for LFS 7.0 by Bruce Dubbs <bdubbs@linuxfromscratch,org> + +# Call with: IFCONFIG=<filename> /lib/services/dhcpcd <IFACE> <up | down> + +#$LastChangedBy: bdubbs $ +#$Date: 2012-04-09 21:48:51 +0200 (Mon, 09 Apr 2012) $ + +. /lib/lsb/init-functions +. $IFCONFIG + +pidfile="/var/run/dhcpcd-$1.pid" + +case "$2" in + up) + # Cosmetic output not needed for multiple services + if ! $(echo ${SERVICE} | grep -q " "); then + log_info_msg2 "\n" # Terminate the previous message + fi + + log_info_msg "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 + log_warning_msg "dhcpcd is already running!" + exit 2 + fi + fi + + /sbin/dhcpcd $1 $DHCP_START + evaluate_retval + ;; + + down) + log_info_msg "Stopping dhcpcd on the $1 interface..." + + if [ -z "$DHCP_STOP" ]; then + killproc -p "${pidfile}" /sbin/dhcpcd + + else + /sbin/dhcpcd $1 $DHCP_STOP &> /dev/null + + if [ "$?" -eq 1 ]; then + log_warning_msg "dhcpcd not running!" + exit 2 + fi + fi + + evaluate_retval + ;; + + *) + echo "Usage: $0 [interface] {up|down}" + exit 1 + ;; +esac + +# End services/dhcpcd |