From efee4ebf43e376a7cd8b8abcef0c70aa90427bb4 Mon Sep 17 00:00:00 2001 From: davidovski Date: Tue, 1 Mar 2022 22:01:26 +0000 Subject: initial commit --- net-services/dhcpcd | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 net-services/dhcpcd (limited to 'net-services/dhcpcd') diff --git a/net-services/dhcpcd b/net-services/dhcpcd new file mode 100755 index 0000000..050413c --- /dev/null +++ b/net-services/dhcpcd @@ -0,0 +1,70 @@ +#!/bin/bash +# Begin services/dhcpcd + +# Origianlly dased upon lfs-bootscripts-1.12 $NETWORK_DEVICES/if{down,up} +# Rewritten by Nathan Coulson +# Adapted for dhcpcd by DJ Lucas +# Update for LFS 7.0 by Bruce Dubbs + +# Call with: IFCONFIG= /lib/services/dhcpcd + +#$LastChangedBy: bdubbs $ +#$Date: 2012-04-09 19:48:51 +0000 (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 + + echo "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 + echo "dhcpcd is already running!" + exit 2 + fi + fi + + /sbin/dhcpcd $1 $DHCP_START + #evaluate_retval + ;; + + down) + echo "Stopping dhcpcd on the $1 interface..." + + if [ -z "$DHCP_STOP" ]; then + kill -9 $(cat ${pidfile}) + rm -f ${pidfile} + + else + /sbin/dhcpcd $1 $DHCP_STOP &> /dev/null + + if [ "$?" -eq 1 ]; then + echo "dhcpcd not running!" + exit 2 + fi + fi + + #evaluate_retval + ;; + + *) + echo "Usage: $0 [interface] {up|down}" + exit 1 + ;; +esac + +# End services/dhcpcd -- cgit v1.2.1