[Initng-svn] r3713 - initng-ifiles/trunk/scripts/net

svn at initng.thinktux.net svn at initng.thinktux.net
Thu Apr 6 20:34:14 CEST 2006


Author: makomk
Date: Thu Apr  6 20:34:12 2006
New Revision: 3713

Modified:
   initng-ifiles/trunk/scripts/net/interface
Log:
Stop dhcpcd when the net/ script is stopped


Modified: initng-ifiles/trunk/scripts/net/interface
==============================================================================
--- initng-ifiles/trunk/scripts/net/interface	(original)
+++ initng-ifiles/trunk/scripts/net/interface	Thu Apr  6 20:34:12 2006
@@ -6,21 +6,21 @@
 	echo "config_$1 routes_$1 fallback_$1 fallback_route_$1 metric_$1"
 }
 
-dhcp_start() {
+dhcp_start_stop() {
 	if [[ ( -x /usr/sbin/udhcpc || -x /sbin/udhcpc ) && ${mods} == *' udhcpc '* ]]; then
-		ngc -u "daemon/udhcpc/$1"
+		ngc $1 "daemon/udhcpc/$2"
 	elif [[ -x /sbin/dhclient && ${mods} == *' dhclient '* ]]; then
-		ngc -u "daemon/dhclient/$1"
+		ngc $1 "daemon/dhclient/$2"
 	elif [[ -x /sbin/pump && ${mods} == *' pump '* ]]; then
-		ngc -u "daemon/pump/$1"
+		ngc $1 "daemon/pump/$2"
 	elif [[ -x /sbin/dhcpcd ]]; then
-		ngc -u "daemon/dhcpcd/$1"
+		ngc $1 "daemon/dhcpcd/$2"
 	elif [[ -x /usr/sbin/udhcpc || -x /sbin/udhcpc ]]; then
-		ngc -u "daemon/udhcpc/$1"
+		ngc $1 "daemon/udhcpc/$2"
 	elif [[ -x /sbin/dhclient ]]; then
-		ngc -u "daemon/dhclient/$1"
+		ngc $1 "daemon/dhclient/$2"
 	elif [[ -x /sbin/pump ]]; then
-		ngc -u "daemon/pump/$1"
+		ngc $1 "daemon/pump/$2"
 	else
 		eerror "No DHCP client available"
 		return 1
@@ -81,7 +81,7 @@
 
 	if [[ -z ${config} ]]; then
 		ewarn "No configuration found - defaulting to DHCP"
-		dhcp_start ${iface}
+		dhcp_start_stop -u ${iface}
 		return $?
 	fi
 
@@ -98,7 +98,7 @@
 
 		case "${conf[0]}" in
 			"null") added=1 ;;
-			"dhcp") dhcp_start ${iface} && added=1 ;;
+			"dhcp") dhcp_start_stop -u ${iface} && added=1 ;;
 			*) interface_add_address ${iface} ${conf[@]} && added=1 ;;
 		esac
 		
@@ -142,6 +142,19 @@
 		eend $? || return 1
 	fi
 
+	if [[ -z ${config} ]]; then
+		dhcp_start_stop -d ${iface}
+	fi
+
+	local i
+
+	for (( i=0; i<${#config[@]}; i++ )); do
+		local -a conf=( ${config[i]} )
+		if [[ "${conf[0]}" == "dhcp" ]]; then
+		        dhcp_start_stop -d ${iface}
+		fi
+	done
+
 	interface_del_addresses ${iface}
 	interface_iface_stop ${iface}
 


More information about the Initng-svn mailing list