SVN: rc-scripts/branches/busybox: rc.d/init.d/cryptsetup rc.d/init.d/functions sysconfig/network-scr...

baggins baggins at pld-linux.org
Thu Mar 26 14:04:13 CET 2009


Author: baggins
Date: Thu Mar 26 14:04:12 2009
New Revision: 10251

Modified:
   rc-scripts/branches/busybox/rc.d/init.d/cryptsetup
   rc-scripts/branches/busybox/rc.d/init.d/functions
   rc-scripts/branches/busybox/sysconfig/network-scripts/functions.network
   rc-scripts/branches/busybox/sysconfig/network-scripts/ifup-routes
Log:
- work around busybox [[ failure (Thanks glen!)


Modified: rc-scripts/branches/busybox/rc.d/init.d/cryptsetup
==============================================================================
--- rc-scripts/branches/busybox/rc.d/init.d/cryptsetup	(original)
+++ rc-scripts/branches/busybox/rc.d/init.d/cryptsetup	Thu Mar 26 14:04:12 2009
@@ -151,10 +151,10 @@
     return $fnval
 }
 
+[ -f /etc/crypttab ] || return
+
 # if not invoked directly, return to caller
-if [[ "$0" != *cryptsetup ]] || [ ! -f /etc/crypttab ]; then
-	return
-fi
+case "$0" in *cryptsetup);; *) exit;; esac
 
 . /etc/rc.d/init.d/functions
 

Modified: rc-scripts/branches/busybox/rc.d/init.d/functions
==============================================================================
--- rc-scripts/branches/busybox/rc.d/init.d/functions	(original)
+++ rc-scripts/branches/busybox/rc.d/init.d/functions	Thu Mar 26 14:04:12 2009
@@ -548,7 +548,7 @@
 		--pidfile)
 			shift
 			pidfile="$1"
-			[[ "$pidfile" != /* ]] && pidfile="/var/run/$pidfile"
+			case "$pidfile" in /*);; *) pidfile="/var/run/$pidfile";; esac
 			;;
 		--makepid)
 			makepid=1
@@ -660,7 +660,7 @@
 		case $1 in
 		--pidfile)
 			pidfile="$2"
-			[[ "$pidfile" != /* ]] && pidfile="/var/run/$pidfile"
+			case "$pidfile" in /*);; *) pidfile="/var/run/$pidfile";; esac
 			shift 2
 			;;
 		--waitforname)
@@ -795,11 +795,10 @@
 	fi
 
 	# First try pidfile or "/var/run/*.pid"
-	if [[ "$pidfile" = /* ]]; then
-		pidfile="${pidfile}"
-	else
-		pidfile="/var/run/${pidfile}";
-	fi
+	case "$pidfile" in
+		/*)pidfile="${pidfile}";;
+		*) pidfile="/var/run/$pidfile";;
+	esac
 	if [ -f "${pidfile}" ]; then
 		local p pid=""
 		for p in $(< "${pidfile}"); do
@@ -817,7 +816,7 @@
 	local pid subsys daemon cpuset_msg pidfile
 	if [ "$1" = "--pidfile" ]; then
 		pidfile=$2
-		[[ "$pidfile" != /* ]] && pidfile="/var/run/$pidfile"
+		case "$pidfile" in /*);; *) pidfile="/var/run/$pidfile";; esac
 		shift 2
 	fi
 

Modified: rc-scripts/branches/busybox/sysconfig/network-scripts/functions.network
==============================================================================
--- rc-scripts/branches/busybox/sysconfig/network-scripts/functions.network	(original)
+++ rc-scripts/branches/busybox/sysconfig/network-scripts/functions.network	Thu Mar 26 14:04:12 2009
@@ -13,15 +13,16 @@
 	DEVNAME=${DEVNAME##ifcfg-}
 	DEVNAME=${DEVNAME##tnlcfg-}
 
-	if [[ "$CONFIG" = /* ]]; then
-		if [ -f "$CONFIG" ] ; then
+	case "$CONFIG" in
+		/*) if [ -f "$CONFIG" ] ; then
 			. "$CONFIG"
 			foundconfig=1
-		fi
-	elif [ -f "/etc/sysconfig/interfaces/$CONFIG" ] ; then
-		. "/etc/sysconfig/interfaces/$CONFIG"
-		foundconfig=1
-	fi
+		    fi ;;
+		*) if [ -f "/etc/sysconfig/interfaces/$CONFIG" ] ; then
+			. "/etc/sysconfig/interfaces/$CONFIG"
+			foundconfig=1
+		   fi ;;
+	esac
 
 	# This is sanity check so that if you've copied ifcfg-eth0 to ifcfg-eth1
 	# and forgot to alter DEVICE= line you won't accidentally bring down eth0
@@ -32,9 +33,7 @@
 		exit 1
 	fi
 
-	if [ "${PREFIX}" ] && [[ "$IPADDR" != */* ]]; then
-		IPADDR="$IPADDR/$PREFIX"
-	fi
+	case "$IPADDR" in */*);; *) [ "${PREFIX}" ] && IPADDR="$IPADDR/$PREFIX";; esac
 }
 
 do_netreport ()
@@ -193,18 +192,19 @@
 
 	eval IP4ADDR="\$IPADDR${IP4_PRIM_IF:-}"
 	# check if ipaddr doesn't contain network length -- use $NETMASK then
-	if [[ "$IP4ADDR" != */* ]] && [ "$NETMASK" ]; then
-		IP4ADDR=$IP4ADDR/$(calcprefix $NETMASK)
-	fi
+	case "$IP4ADDR" in */*);; *) [ "$NETMASK" ] && IP4ADDR=$IP4ADDR/$(calcprefix $NETMASK);; esac
 
 	# check if we have ipv6 or ipv4 address
-	if [[ "${IP4ADDR}" = *:* ]]; then
+	case "$IP4ADDR" in
+	*:*)
 		IP6ADDR=${IP4ADDR}
 		IP4ADDR=""
-	else
+		;;
+	*)
 		eval IP4ADDROPT="\$IP_AOPTS${IP4_PRIM_IF:-}"
 		eval IP4ROUTEOPT="\$IP_ROPTS${IP4_PRIM_IF:-}"
-	fi
+		;;
+	esac
 	if [ "${IP6_PRIM_IF}" ] ; then
 		eval IP6ADDR="\$IPADDR${IP6_PRIM_IF:-}"
 		eval IP6ADDROPT="\$IPV6_AOPTS${IP6_PRIM_IF:-}"

Modified: rc-scripts/branches/busybox/sysconfig/network-scripts/ifup-routes
==============================================================================
--- rc-scripts/branches/busybox/sysconfig/network-scripts/ifup-routes	(original)
+++ rc-scripts/branches/busybox/sysconfig/network-scripts/ifup-routes	Thu Mar 26 14:04:12 2009
@@ -11,14 +11,17 @@
 
 # note the trailing white space character in the grep gets rid of aliases
 grep -E "^($DEVICE|any)[[:blank:]]" /etc/sysconfig/static-routes | while read device args; do
-	if [[ "$args" = *:* ]]; then
+	case "$args" in
+	*:*)
 		if is_no "$IPV6_NETWORKING"; then
 			continue
 		fi
-	else
+		;;
+	*)
 		if is_no "$IPV4_NETWORKING"; then
 			continue
 		fi
-	fi
+		;;
+	esac
 	/sbin/ip route add $args dev $REALDEVICE
 done


More information about the pld-cvs-commit mailing list