]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
- partial merge of baggin's busybox branch changes
authorElan Ruusamäe <glen@pld-linux.org>
Tue, 17 Nov 2009 07:10:46 +0000 (07:10 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Tue, 17 Nov 2009 07:10:46 +0000 (07:10 +0000)
svn-id: @10976

rc.d/init.d/cryptsetup
rc.d/init.d/functions
rc.d/init.d/sys-chroots
rc.d/rc
rc.d/rc.sysinit

index e95ad3a6886ca6e0df383f871d83782af9fcf3c8..da391960f91c6d32c4ff4ebe1e6edbcc50416860 100755 (executable)
@@ -151,10 +151,10 @@ halt_crypto() {
     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
 
index de87b9451f8572637de311010cae0ef27a8548ee..4f4c05f5b4da063a8b5e6e52c14f7c3460ec7521 100644 (file)
@@ -549,7 +549,7 @@ daemon() {
                --pidfile)
                        shift
                        pidfile="$1"
-                       [[ "$pidfile" != /* ]] && pidfile="/var/run/$pidfile"
+                       case "$pidfile" in /*);; *) pidfile="/var/run/$pidfile";; esac
                        ;;
                --makepid)
                        makepid=1
@@ -661,7 +661,7 @@ killproc() {
                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 @@ pidofproc() {
        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 @@ status() {
        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 @@ check_portmapper() {
                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 @@ is_fsmounted() {
                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
index 6f72d47dcb5f252166d70c606b8d6795e4d9441c..595c9b6074d73f96cdb16482f815f16c8e0b7b53 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/busybox sh
 #
 # sys-chroots  Starts and stops services in chroots
 #
@@ -18,7 +18,7 @@ fi
 
 CMD="$1"
 
-set $(/sbin/runlevel)
+set $(runlevel)
 runlevel=$2
 previous=$1
 export runlevel previous
@@ -48,7 +48,7 @@ start() {
 
                # 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 @@ stop() {
                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
diff --git a/rc.d/rc b/rc.d/rc
index c208d4aca90f80a85c154c9fb8727649e3eefc65..99cf904afc3058a6e68d4679e81a34ae233865f3 100755 (executable)
--- a/rc.d/rc
+++ b/rc.d/rc
@@ -50,7 +50,7 @@ fi
 
 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
index a34729669bbd5f3c8e20f0515ff7570d57b53bcd..fb85b8682b0c05b43aeca3c7130fd19433ff9f7d 100755 (executable)
@@ -201,7 +201,7 @@ fi
 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 @@ if ! is_yes "$VSERVER"; then
 
        # 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 @@ if ! is_yes "$VSERVER"; then
        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 @@ if ! is_yes "$VSERVER"; then
        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 @@ if ! is_yes "$VSERVER"; then
        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 @@ if ! is_yes "$VSERVER"; then
        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 @@ chown root:root /tmp/.ICE-unix
 [ -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
 
This page took 0.243033 seconds and 4 git commands to generate.