[Lunar-commits] r23823 - moonbase/branches/crater/net/net-tools

Moritz Heiber moe at lunar-linux.org
Tue Mar 27 00:27:54 CEST 2007


Author: moe
Date: 2007-03-27 00:27:54 +0200 (Tue, 27 Mar 2007)
New Revision: 23823

Modified:
   moonbase/branches/crater/net/net-tools/network
Log:
Some fixes and tweaks.



Modified: moonbase/branches/crater/net/net-tools/network
===================================================================
--- moonbase/branches/crater/net/net-tools/network	2007-03-26 21:01:15 UTC (rev 23822)
+++ moonbase/branches/crater/net/net-tools/network	2007-03-26 22:27:54 UTC (rev 23823)
@@ -104,7 +104,7 @@
 			case $DHCP_CLIENT in
 				[dD][hH][cC][pP][cC][dD])
 				PIDFILE=/var/run/dhcpcd-$1.pid
-				RUNFILE=/usr/sbin/dhcpcd
+				RUNFILE=/sbin/dhcpcd
 				;;
 			
 				[dD][hH][cC][lL][iI][eE][nN][tT])
@@ -223,41 +223,40 @@
 		esac
 	fi
 	
-	case $DHCP_CLIENT in
-		[dD][hH][cC][pP][cC][dD])
-			KILLCMD="dhcpcd -k"
-			PIDFILE=/var/run/dhcpcd-$1.pid
-		;;
-		
-		[dD][hH][cC][lL][iI][eE][nN][tT])
-			PIDFILE=/var/run/dhclient-$1.pid
-		;;
+	if [ "$ADDRESS" == "dhcp" ] ; then
+		case $DHCP_CLIENT in
+			[dD][hH][cC][pP][cC][dD])
+				KILLCMD="dhcpcd -k $1"
+				PIDFILE=/var/run/dhcpcd-$1.pid
+			;;
 
-		[uU][dD][hH][cC][pP][cC])
+			[dD][hH][cC][lL][iI][eE][nN][tT])
+				PIDFILE=/var/run/dhclient-$1.pid
+			;;
+
+			[uU][dD][hH][cC][pP][cC])
 			PIDFILE=/var/run/udhcpc-$1.pid
-		;;
-	esac
+			;;
+		esac
 
-	if [ -e $PIDFILE ]; then
-		if [ -z "$KILLCMD" ]; then
-			kill `cat $PIDFILE`
-		else
-			$KILLCMD
-		fi
+		if [ -e $PIDFILE ]; then
+			if [ -z "$KILLCMD" ]; then
+				kill `cat $PIDFILE`
+			else
+				$KILLCMD
+			fi
 
-		if [ -e $PIDFILE ]; then
 			rm -f $PIDFILE
+			sleep 1
+		else
+			case $AUTO in
+		    		[!yY])
+			 		echo -n " not started"
+			 		return -1
+		    		;;
+			esac
 		fi
-		sleep 1
-	else
-		case $AUTO in
-		    [!yY])
-			 echo -n " not started"
-			 return -1
-		    ;;
-		esac
 	fi
-
 	
 	$IFCONFIG $1 down
 
@@ -312,9 +311,9 @@
 {
 	if [ -z "$2" ]; then
 		echo "Stopping network:"
-		for device in `/sbin/ifconfig | cut -d" " -f1 | uniq | grep -E [a-z0-9]+ | grep -v lo | sort -r`; do
+		for device in `$IFCONFIG | cut -d" " -f1 | uniq | grep -E [a-z0-9]+ | grep -v lo | sort -r`; do
 			echo -n " * Stopping $device: "
-			device_stop $device auto
+			device_stop $device
 			chkresult
 		done
 	else
@@ -330,16 +329,18 @@
 		echo "Restarting network:"
 		for device in `ls -1 $CONFIGS | cut -d"-" -f1 | uniq`; do
 			echo -n " * Stopping $device: "
-			device_stop $device auto
+			device_stop $device
 			chkresult
+			sleep 1
 			echo -n " * Starting $device: "
-			device_start $device auto
+			device_start $device
 			chkresult
 		done
 	else
 		echo -n " * Stopping $2: "
 		device_stop $2
 		chkresult
+		sleep 1
 		echo -n " * Starting $2: "
 		device_start $2
 		chkresult
@@ -347,7 +348,7 @@
 }
 
 case "$1" in
-	start|stop)
+	start|stop|restart)
 		;;
 	
 	*)



More information about the Lunar-commits mailing list