SVN: rc-scripts/trunk/rc.d: init.d/cryptsetup init.d/functions init.d/sys-chroots rc rc.sysinit

glen glen at pld-linux.org
Tue Nov 17 08:10:47 CET 2009


Author: glen
Date: Tue Nov 17 08:10:46 2009
New Revision: 10976

Modified:
   rc-scripts/trunk/rc.d/init.d/cryptsetup
   rc-scripts/trunk/rc.d/init.d/functions
   rc-scripts/trunk/rc.d/init.d/sys-chroots
   rc-scripts/trunk/rc.d/rc
   rc-scripts/trunk/rc.d/rc.sysinit
Log:
- partial merge of baggin's busybox branch changes


Modified: rc-scripts/trunk/rc.d/init.d/cryptsetup
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/cryptsetup	(original)
+++ rc-scripts/trunk/rc.d/init.d/cryptsetup	Tue Nov 17 08:10:46 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);; *) return;; esac
 
 . /etc/rc.d/init.d/functions
 

Modified: rc-scripts/trunk/rc.d/init.d/functions
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/functions	(original)
+++ rc-scripts/trunk/rc.d/init.d/functions	Tue Nov 17 08:10:46 2009
@@ -549,7 +549,7 @@
 		--pidfile)
 			shift
 			pidfile="$1"
-			[[ "$pidfile" != /* ]] && pidfile="/var/run/$pidfile"
+			case "$pidfile" in /*);; *) pidfile="/var/run/$pidfile";; esac
 			;;
 		--makepid)
 			makepid=1
@@ -661,7 +661,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" -o "$1" = "-p" ]; then
 		pidfile=$2
-		[[ "$pidfile" != /* ]] && pidfile="/var/run/$pidfile"
+		case "$pidfile" in /*);; *) pidfile="/var/run/$pidfile";; esac
 		shift 2
 	fi
 
@@ -980,9 +979,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
 }
@@ -999,7 +997,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/trunk/rc.d/init.d/sys-chroots
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/sys-chroots	(original)
+++ rc-scripts/trunk/rc.d/init.d/sys-chroots	Tue Nov 17 08:10:46 2009
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/busybox sh
 #
 # sys-chroots	Starts and stops services in chroots
 #
@@ -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/trunk/rc.d/rc
==============================================================================
--- rc-scripts/trunk/rc.d/rc	(original)
+++ rc-scripts/trunk/rc.d/rc	Tue Nov 17 08:10:46 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

Modified: rc-scripts/trunk/rc.d/rc.sysinit
==============================================================================
--- rc-scripts/trunk/rc.d/rc.sysinit	(original)
+++ rc-scripts/trunk/rc.d/rc.sysinit	Tue Nov 17 08:10:46 2009
@@ -201,7 +201,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
@@ -238,7 +238,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
@@ -261,13 +261,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
 
@@ -282,8 +282,8 @@
 	fi
 
 	# Check if timezone definition is available
-	if [ -e /etc/localtime ] ; then
-		if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
+	if [ -e /etc/localtime -a -e /dev/rtc ] ; then
+		if run_cmd "$(nls 'Setting clock')$CLOCKDEF" hwclock $CLOCKFLAGS; then
 			show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
 		fi
 	else
@@ -892,8 +892,8 @@
 	fi
 
 	# Set the clock if timezone definition wasn't available (eg. /usr not mounted)
-	if is_yes "$TIME_SETUP_DELAYED"; then
-		if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
+	if is_yes "$TIME_SETUP_DELAYED" && [ -e /dev/rtc ]; then
+		if run_cmd "$(nls 'Setting clock')$CLOCKDEF" hwclock $CLOCKFLAGS; then
 			show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
 		fi
 	fi
@@ -909,7 +909,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
@@ -976,7 +976,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
 


More information about the pld-cvs-commit mailing list