SVN: rc-scripts/branches/busybox: rc.d/init.d/functions rc.d/init.d/network rc.d/init.d/single rc.d/...

baggins baggins at pld-linux.org
Thu Mar 26 15:39:07 CET 2009


Author: baggins
Date: Thu Mar 26 15:39:06 2009
New Revision: 10260

Modified:
   rc-scripts/branches/busybox/rc.d/init.d/functions
   rc-scripts/branches/busybox/rc.d/init.d/network
   rc-scripts/branches/busybox/rc.d/init.d/single
   rc-scripts/branches/busybox/rc.d/init.d/sys-chroots
   rc-scripts/branches/busybox/rc.d/rc
   rc-scripts/branches/busybox/rc.d/rc.sysinit
   rc-scripts/branches/busybox/sysconfig/network-scripts/ifup
   rc-scripts/branches/busybox/sysconfig/network-scripts/ifup-post
Log:
- use as many bb applets as possible


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 15:39:06 2009
@@ -250,25 +250,6 @@
 	fi
 }
 
-if [ ! -x /bin/printf ]; then
-	# printf equivalent
-	# FIXME: buggy when single or double quotes in message!
-	printf() {
-		local text m
-		text="$1"
-		shift
-		if [ $# -gt 0 ]; then
-			m="$1"
-			shift
-			while [ $# -gt 0 ]; do
-				m="$m\",\"$1"
-				shift
-			done
-		fi
-		awk "BEGIN {printf \"$text\", \"$m\"; }"
-	}
-fi
-
 # National language support function
 nls() {
 	local msg_echo nls_domain text message
@@ -522,12 +503,12 @@
 			;;
 		--user)
 			shift
-			[ "$1" != "root" ] && prog="/bin/su $1 -s /bin/sh -c \""
+			[ "$1" != "root" ] && prog="su $1 -c \""
 			user=$1
 			;;
 		--fork)
 			fork=1
-			prog="/usr/bin/setsid sh -c \""
+			prog="setsid sh -c \""
 			end='&'
 			;;
 		--chdir)
@@ -979,9 +960,8 @@
 		else
 			return 1
 		fi
-	elif [ -x /sbin/pidof ]; then
-		[ -z "$(/sbin/pidof portmap)" -a \
-			-z "$(/sbin/pidof rpcbind)" ] && return 1
+	elif [ -z "$(pidof portmap)" -a -z "$(pidof rpcbind)" ]; then
+		return 1
 	fi
 	return 0
 }
@@ -998,7 +978,7 @@
 		grep -qE "[[:blank:]]$mntpoint[[:blank:]]+$fstype[[:blank:]]" /proc/mounts
 		return $?
 	else
-		if [ "$(/bin/stat -L -f -c %T $mntpoint 2>/dev/null)" = "$fstype" ]; then
+		if [ "$(stat -L -f -c %T $mntpoint 2>/dev/null)" = "$fstype" ]; then
 			return 0
 		else
 			return 1

Modified: rc-scripts/branches/busybox/rc.d/init.d/network
==============================================================================
--- rc-scripts/branches/busybox/rc.d/init.d/network	(original)
+++ rc-scripts/branches/busybox/rc.d/init.d/network	Thu Mar 26 15:39:06 2009
@@ -48,7 +48,7 @@
 	modprobe_net
 
 	# Setup interfaces names
-	if [ -x /sbin/nameif -a -f /etc/mactab -a -x /usr/bin/wc ] && [ $(grep -vsE '^(#| *$)' /etc/mactab | wc -l) -gt 0 ]; then
+	if [ -x /sbin/nameif -a -f /etc/mactab ] && [ $(grep -vsE '^(#| *$)' /etc/mactab | wc -l) -gt 0 ]; then
 		run_cmd "Setting interfaces names (nameif)" /sbin/nameif
 	fi
 

Modified: rc-scripts/branches/busybox/rc.d/init.d/single
==============================================================================
--- rc-scripts/branches/busybox/rc.d/init.d/single	(original)
+++ rc-scripts/branches/busybox/rc.d/init.d/single	Thu Mar 26 15:39:06 2009
@@ -30,7 +30,7 @@
 	rm -f /var/lock/subsys/*
 
 	# this looks nicer
-	[ -x /usr/bin/clear ] && /usr/bin/clear
+	clear
 
 	# make sure modprobe is working
 	if [ -f /proc/sys/kernel/modprobe ]; then

Modified: rc-scripts/branches/busybox/rc.d/init.d/sys-chroots
==============================================================================
--- rc-scripts/branches/busybox/rc.d/init.d/sys-chroots	(original)
+++ rc-scripts/branches/busybox/rc.d/init.d/sys-chroots	Thu Mar 26 15:39:06 2009
@@ -18,7 +18,7 @@
 
 CMD="$1"
 
-set $(/sbin/runlevel)
+set $(runlevel)
 runlevel=$2
 previous=$1
 export runlevel previous
@@ -48,7 +48,7 @@
 
 		# Cleaning part, keep in sync with rc.sysinit
 
-		chroot $dir /bin/sh -c '
+		chroot $dir sh -c '
 		. /etc/rc.d/init.d/functions
 		# Clear mtab
 		:>/etc/mtab
@@ -140,8 +140,8 @@
 		msg_stopping "System chroots services for $dir"; started
 		rm -f $dir/var/lock/subsys/network
 		chroot $dir /etc/rc.d/rc $runlevel chroot
-		chroot $dir /bin/sh -c "grep -q selinuxfs /proc/filesystems && umount /selinux"
-		chroot $dir /bin/sh -c "grep -q sysfs /proc/filesystems && umount /sys"
+		chroot $dir sh -c "grep -q selinuxfs /proc/filesystems && umount /selinux"
+		chroot $dir sh -c "grep -q sysfs /proc/filesystems && umount /sys"
 		chroot $dir umount -a
 		chroot $dir umount /proc
 	done

Modified: rc-scripts/branches/busybox/rc.d/rc
==============================================================================
--- rc-scripts/branches/busybox/rc.d/rc	(original)
+++ rc-scripts/branches/busybox/rc.d/rc	Thu Mar 26 15:39:06 2009
@@ -50,7 +50,7 @@
 
 if [ "$argv2" != "chroot" ]; then
 	# Now find out what the current and what the previous runlevel are.
-	set $(/sbin/runlevel)
+	set $(runlevel)
 	runlevel=$2
 	previous=$1
 	export runlevel previous
@@ -72,7 +72,7 @@
 	if [ "$argv2" != "chroot" ] && ! is_yes "$VSERVER" && \
 		[ "$runlevel" = "0" -o "$runlevel" = "6" ]; then
 		CONSOLE=/dev/tty1
-		[ -x /usr/bin/chvt ] && /usr/bin/chvt 1 && echo > $CONSOLE
+		chvt 1 && echo > $CONSOLE
 		exec 0<> /dev/console 1>&0 2>&0
 	fi
 else

Modified: rc-scripts/branches/busybox/rc.d/rc.sysinit
==============================================================================
--- rc-scripts/branches/busybox/rc.d/rc.sysinit	(original)
+++ rc-scripts/branches/busybox/rc.d/rc.sysinit	Thu Mar 26 15:39:06 2009
@@ -199,7 +199,7 @@
 if ! is_yes "$VSERVER"; then
 	# Set console loglevel
 	if [ -n "$CONSOLE_LOGLEVEL" ]; then
-		/bin/dmesg -n $CONSOLE_LOGLEVEL
+		dmesg -n $CONSOLE_LOGLEVEL
 	fi
 
 	if ! is_no "$START_UDEV"; then
@@ -228,7 +228,7 @@
 
 	# Configure Linux kernel (initial configuration, some required modules still
 	# may be missing).
-	/sbin/sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
+	sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
 
 	# Set the system clock.
 	ARC=0
@@ -251,13 +251,13 @@
 	fi
 
 	CLOCKDEF=""
-	CLOCKFLAGS="--hctosys"
+	CLOCKFLAGS="-w"
 
 	if is_yes "$UTC" ; then
-		CLOCKFLAGS="$CLOCKFLAGS --utc"
+		CLOCKFLAGS="$CLOCKFLAGS -u"
 		CLOCKDEF="$CLOCKDEF (utc)"
 	else
-		CLOCKFLAGS="$CLOCKFLAGS --localtime"
+		CLOCKFLAGS="$CLOCKFLAGS -l"
 		CLOCKDEF="$CLOCKDEF (local)"
 	fi
 
@@ -273,7 +273,7 @@
 
 	# Check if timezone definition is available
 	if [ -e /etc/localtime -a -e /dev/rtc ] ; then
-		if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
+		if run_cmd "$(nls 'Setting clock')$CLOCKDEF" hwclock $CLOCKFLAGS; then
 			show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
 		fi
 	else
@@ -881,7 +881,7 @@
 
 	# Set the clock if timezone definition wasn't available (eg. /usr not mounted)
 	if is_yes "$TIME_SETUP_DELAYED" && [ -e /dev/rtc ]; then
-		if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
+		if run_cmd "$(nls 'Setting clock')$CLOCKDEF" hwclock $CLOCKFLAGS; then
 			show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
 		fi
 	fi
@@ -897,7 +897,7 @@
 	fi
 
 	# ... and here finish configuring parameters
-	/sbin/sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
+	sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
 else
 	# /var/log should be writable now, so start saving the boot output
 	if [ "$RC_BOOTLOG" ]; then
@@ -964,7 +964,7 @@
 [ -n "$SELINUX" ] && restorecon /tmp/.ICE-unix >/dev/null 2>&1
 
 if ! is_yes "$VSERVER"; then
-	run_cmd "Enabling swap space" /bin/true
+	run_cmd "Enabling swap space" true
 	# Right, now turn on swap in case we swap to files
 	swapon -a >/dev/null 2>&1
 
@@ -994,7 +994,7 @@
 	chmod 0600 /var/log/dmesg /var/log/dmesg.0
 fi
 
-kill -TERM $(/sbin/pidof getkey) >/dev/null 2>&1
+kill -TERM $(pidof getkey) >/dev/null 2>&1
 } &
 
 # extra check if the background process we just spawned is still running,

Modified: rc-scripts/branches/busybox/sysconfig/network-scripts/ifup
==============================================================================
--- rc-scripts/branches/busybox/sysconfig/network-scripts/ifup	(original)
+++ rc-scripts/branches/busybox/sysconfig/network-scripts/ifup	Thu Mar 26 15:39:06 2009
@@ -161,7 +161,7 @@
 		DHCP_ARGS="$DHCP_OPTIONS $DHCP_ARGS"
 
 		if check_link_down ${DEVICE}; then
-			run_cmd "$(nls 'Determining IP information for %s (%s)' "$DEVICE" "${DHCP_CLIENT##*/}")" /bin/false
+			run_cmd "$(nls 'Determining IP information for %s (%s)' "$DEVICE" "${DHCP_CLIENT##*/}")" false
 			nls '%s: Check cable/radio on-off switch?' "$DEVICE"
 			exit 1
 		fi

Modified: rc-scripts/branches/busybox/sysconfig/network-scripts/ifup-post
==============================================================================
--- rc-scripts/branches/busybox/sysconfig/network-scripts/ifup-post	(original)
+++ rc-scripts/branches/busybox/sysconfig/network-scripts/ifup-post	Thu Mar 26 15:39:06 2009
@@ -60,7 +60,7 @@
 if [ -n "$NEEDHOSTNAME" -a "${DEVICETYPE}" != "ppp" -a "${DEVICETYPE}" != "slip" ]; then
 	IPADDR=$(ip -f inet addr show dev ${DEVICE} |
 		awk '/inet/ { print $2 }' |awk -F"/" '{ print $1 }')
-	eval $(/bin/ipcalc --silent --hostname ${IPADDR}) && set_hostname $HOSTNAME
+	eval $(ipcalc -s -h ${IPADDR}) && set_hostname $HOSTNAME
 fi
 
 # run tleds software


More information about the pld-cvs-commit mailing list