Author: baggins
Date: Tue Oct 25 20:22:44 2005
New Revision: 6489

Modified:
   rc-scripts/trunk/rc.d/rc
   rc-scripts/trunk/rc.d/rc.shutdown
   rc-scripts/trunk/rc.d/rc.sysinit
Log:
- add support for running inside vservers, the diff may seem huge but it's
  mostly white space change


Modified: rc-scripts/trunk/rc.d/rc
==============================================================================
--- rc-scripts/trunk/rc.d/rc    (original)
+++ rc-scripts/trunk/rc.d/rc    Tue Oct 25 20:22:44 2005
@@ -21,9 +21,14 @@
 
 # Get terminal size of standard input of the system console
 [ -z "$CONSOLE" ] && CONSOLE=/dev/console
-set -- $(stty size < $CONSOLE 2>/dev/null)
-  LINES=$1
-COLUMNS=$2
+if [ -c $CONSOLE ]; then
+       set -- $(stty size < $CONSOLE 2>/dev/null)
+         LINES=$1
+       COLUMNS=$2
+else
+         LINES=
+       COLUMNS=
+fi
 export LINES COLUMNS CONSOLE
   
 # NLS
@@ -79,7 +84,8 @@
 # virtual console, and send messages to /dev/console 
 # (it can be serial console too) 
 if [ "$COLUMNS" -gt 0 ]; then
-       if [ "$argv2" != "chroot" ] && [ "$runlevel" = "0" -o "$runlevel" = "6" 
]; then
+       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
                exec 0<> /dev/console 1>&0 2>&0
@@ -93,7 +99,7 @@
 # See if we want to be in user confirmation mode
 if [ "$previous" = "N" ]; then
        if grep -qi confirm /proc/cmdline >/dev/null 2>/dev/null \
-               || [ -f /var/run/confirm ]; then
+               || [ -f /var/run/confirm ] || ! is_yes "$VSERVER"; then
                rm -f /var/run/confirm
                CONFIRM="yes"
                nls "Entering interactive startup"
@@ -139,8 +145,16 @@
        export progress=0
 fi
 
+if is_yes "$VSERVER"; then
+       # if runlevel is not 0 (halt) or 6 (reboot) run rc.sysinit
+       # BUT only if rc is run standalone (not run by init, as init will run 
rc.sysinit)
+       if [ "$previous" != "N" -a "$runlevel" != "0" -a "$runlevel" != "6" ]; 
then
+               /etc/rc.d/rc.sysinit $runlevel
+       fi
+fi
+
 # set onlcr to avoid staircase effect and do not lock scrolling
-stty onlcr -ixon 0>&1
+stty onlcr -ixon 0>&1 2>/dev/null
 
 # Say something ;)
 af2=$(termput setaf $CRESMAN)
@@ -233,7 +247,7 @@
        TMPDIR=/dev/null
        export TMPDIR
        if [ "$argv2" != "chroot" ]; then
-           exec /etc/rc.d/rc.shutdown $runlevel
+           exec /etc/rc.d/rc.shutdown $runlevel $previous
        else
            exit 0
        fi
@@ -258,4 +272,4 @@
 exit 0
 
 # This must be last line !
-# vi:syntax=sh:ts=8:sw=4
+# vi:syntax=sh

Modified: rc-scripts/trunk/rc.d/rc.shutdown
==============================================================================
--- rc-scripts/trunk/rc.d/rc.shutdown   (original)
+++ rc-scripts/trunk/rc.d/rc.shutdown   Tue Oct 25 20:22:44 2005
@@ -28,6 +28,7 @@
 [ "${BASH+bash}" = bash ] && enable kill
 
 runlevel=$1
+previous=$2
 
 run_cmd "Sending all processes the TERM signal" killall5 -15
 sleep 5
@@ -45,92 +46,94 @@
        run_cmd "Turning off quotas for local filesystems" /sbin/quotaoff -a
 fi
 
-# Unmount file systems, killing processes if we have to.
-sig=-15
-retry=3
-force=
-remaining=$(awk '!/(^#| proc | loopfs | devfs | devpts | shm | iso9660 | ramfs 
| tmpfs | sysfs | squashfs |^none|^\/dev\/root| \/ )/ {print $2}' /proc/mounts)
-while [ -n "$remaining" -a "$retry" -gt 0 ]
-do     
-       show "Unmounting file systems" ; busy
-       if ERRORS=$(umount -a $FORCE -t noproc,devfs 2>&1) ; then
-               ok
-       else
-               fail
-               [ -n "$ERRORS" ] && echo "$ERRORS"
-       fi
-       
-       sleep 2
+if ! is_yes "$VSERVER"; then
+       # Unmount file systems, killing processes if we have to.
+       sig=-15
+       retry=3
+       force=
        remaining=$(awk '!/(^#| proc | loopfs | devfs | devpts | shm | iso9660 
| ramfs | tmpfs | sysfs | squashfs |^none|^\/dev\/root| \/ )/ {print $2}' 
/proc/mounts)
-       [ -z "$remaining" ] && break
-       /sbin/fuser -k -m $sig $remaining > /dev/null
-       sleep 5
-       retry=$(($retry-1))
-       sig=-9
-       force="-f"
-done
-
-run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
-
-if is_yes "$EVMS_LVM" || [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then
-        lvmversion=$(/sbin/vgchange --version 2>/dev/null | awk 
'{gsub("vgchange: Logical Volume Manager ",""); gsub("LVM version:     ",""); 
gsub(/\..*/,"");print $1; exit}')
-       if [ "$lvmversion" = "2" ] ; then
-               lvmignorelock="--ignorelockingfailure"
-       else
-               lvmignorelock=""
+       while [ -n "$remaining" -a "$retry" -gt 0 ]
+       do      
+               show "Unmounting file systems" ; busy
+               if ERRORS=$(umount -a $FORCE -t noproc,devfs 2>&1) ; then
+                       ok
+               else
+                       fail
+                       [ -n "$ERRORS" ] && echo "$ERRORS"
+               fi
+               
+               sleep 2
+               remaining=$(awk '!/(^#| proc | loopfs | devfs | devpts | shm | 
iso9660 | ramfs | tmpfs | sysfs | squashfs |^none|^\/dev\/root| \/ )/ {print 
$2}' /proc/mounts)
+               [ -z "$remaining" ] && break
+               /sbin/fuser -k -m $sig $remaining > /dev/null
+               sleep 5
+               retry=$(($retry-1))
+               sig=-9
+               force="-f"
+       done
+
+       run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
+
+       if is_yes "$EVMS_LVM" || [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then
+               lvmversion=$(/sbin/vgchange --version 2>/dev/null | awk 
'{gsub("vgchange: Logical Volume Manager ",""); gsub("LVM version:     ",""); 
gsub(/\..*/,"");print $1; exit}')
+               if [ "$lvmversion" = "2" ] ; then
+                       lvmignorelock="--ignorelockingfailure"
+               else
+                       lvmignorelock=""
+               fi
+               run_cmd "Stopping LVM volume groups" /sbin/vgchange -a n 
$lvmignorelock
        fi
-       run_cmd "Stopping LVM volume groups" /sbin/vgchange -a n $lvmignorelock
-fi
 
-goraidtab=1
-if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ]; then
-       if (grep -qE "^([[:blank:]]|)ARRAY[[:blank:]]" /etc/mdadm.conf 
2>/dev/null); then
-                   run_cmd "Turning off RAID devices" /sbin/mdadm --stop --scan
-                   rc=$?
-                   [ "$rc" -eq 0 ] && goraidtab=0
+       goraidtab=1
+       if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ]; then
+               if (grep -qE "^([[:blank:]]|)ARRAY[[:blank:]]" /etc/mdadm.conf 
2>/dev/null); then
+                           run_cmd "Turning off RAID devices" /sbin/mdadm 
--stop --scan
+                           rc=$?
+                           [ "$rc" -eq 0 ] && goraidtab=0
+               fi
        fi
-fi
-                                                                               
                                
-# turn off raid
-if [ -x /sbin/raidstop -a -f /etc/raidtab -a "$goraidtab" -eq 1 ]; then
-       # we can not use raidstop -a here because this will only stop
-       # devices listed in the default config file which is not always
-       # the case. So we look only for the active raid devices
-       if [ -f /proc/mdstat ] ; then
-               mddevs=$(awk '/^md.* active/ {print $1}' /proc/mdstat)
-               for mddev in $mddevs ; do
-                       show "Turning off RAID for %s" "$mddev"
-                       daemon /sbin/raidstop /dev/$mddev
-               done
-               unset mddev mddevs
+                                                                               
                                        
+       # turn off raid
+       if [ -x /sbin/raidstop -a -f /etc/raidtab -a "$goraidtab" -eq 1 ]; then
+               # we can not use raidstop -a here because this will only stop
+               # devices listed in the default config file which is not always
+               # the case. So we look only for the active raid devices
+               if [ -f /proc/mdstat ] ; then
+                       mddevs=$(awk '/^md.* active/ {print $1}' /proc/mdstat)
+                       for mddev in $mddevs ; do
+                               show "Turning off RAID for %s" "$mddev"
+                               daemon /sbin/raidstop /dev/$mddev
+                       done
+                       unset mddev mddevs
+               fi
+               # runcmd "Turning off RAID" /sbin/raidstop -a
        fi
-       # runcmd "Turning off RAID" /sbin/raidstop -a
-fi
 
-show "Remounting remaining filesystems ro mode"; busy
-if ( mount | awk '/ext2|ext3|reiserfs|xfs|jfs/ { print $3 }' | \
-       while read line; do 
-       mount -n -o ro,remount $line; done ); then
-       ok
-else
-       fail
+       show "Remounting remaining filesystems ro mode"; busy
+       if ( mount | awk '/ext2|ext3|reiserfs|xfs|jfs/ { print $3 }' | \
+               while read line; do 
+               mount -n -o ro,remount $line; done ); then
+               ok
+       else
+               fail
+       fi
 fi
 
 if [ "$runlevel" = "0" ] ; then
                show "The system is halted"; ok
        [ -f /fastboot ] && (show "On the next boot fsck will be skipped."; ok)
 
-        if [ -x /sbin/poweroff-ups -a -f /etc/killpower -a -f 
/etc/sysconfig/ups ] ; then
+       if [ -x /sbin/poweroff-ups -a -f /etc/killpower -a -f 
/etc/sysconfig/ups ] ; then
             . /etc/sysconfig/ups
             is_yes "$POWEROFF_UPS" && /sbin/poweroff-ups
-        fi
-       eval halt -d -p
+       fi
+       [ "$previous" != "unknown" ] && eval halt -d -p
 else
        show "Please stand by while rebooting the system"; ok
        [ -f /fastboot ] && (show "On the next boot fsck will be skipped."; ok)
        [ -x /sbin/kexec ] && /sbin/kexec -e
-       eval reboot -d
+       [ "$previous" != "unknown" ] && eval reboot -d
 fi
 
 # This must be last line !
-# vi:syntax=sh:ts=8:sw=4
+# vi:syntax=sh

Modified: rc-scripts/trunk/rc.d/rc.sysinit
==============================================================================
--- rc-scripts/trunk/rc.d/rc.sysinit    (original)
+++ rc-scripts/trunk/rc.d/rc.sysinit    Tue Oct 25 20:22:44 2005
@@ -61,12 +61,12 @@
 . /etc/rc.d/init.d/functions
 
 # sysfs is also needed before any other things (under kernel > 2.5)
-if grep -q sysfs /proc/filesystems 2>/dev/null ; then
+if ! is_yes "$VSERVER" && grep -q sysfs /proc/filesystems 2>/dev/null ; then
     mount -n -o gid=17 -t sysfs sysfs /sys
 fi
 
 # selinux
-if grep -q selinuxfs /proc/filesystems 2>/dev/null && ! grep -q selinuxfs 
/proc/mounts 2>/dev/null; then
+if ! is_yes "$VSERVER" && grep -q selinuxfs /proc/filesystems 2>/dev/null && ! 
grep -q selinuxfs /proc/mounts 2>/dev/null; then
     mount -n -o gid=17 -t selinuxfs selinuxfs /selinux
 fi
 
@@ -126,242 +126,244 @@
        sleep 1
 fi
 
-# Set console loglevel
-if [ -n "$CONSOLE_LOGLEVEL" ]; then
-       /bin/dmesg -n $CONSOLE_LOGLEVEL
-fi
+# Set the hostname
+run_cmd "$(nls 'Host:') ${HOSTNAME}" hostname ${HOSTNAME}
 
-if [ -f /etc/udev/udev.conf ];then
-       . /etc/udev/udev.conf
+# Set the NIS domain name
+if [ -n "$NISDOMAIN" ]; then
+       run_cmd "$(nls 'NIS Domain:') ${NISDOMAIN}" domainname $NISDOMAIN
+else
+       domainname ""
 fi
 
-[ -x /sbin/start_udev ] && run_cmd "Starting udev" /sbin/start_udev
-       
-# /dev must be also mounted before everything but only if we want use them ;-)
-if is_yes "$MOUNT_DEVFS"; then
-       run_cmd "Mounting Device Filesystem" mount -n -t devfs /dev /dev
-fi
+if ! is_yes "$VSERVER"; then
+       # Set console loglevel
+       if [ -n "$CONSOLE_LOGLEVEL" ]; then
+               /bin/dmesg -n $CONSOLE_LOGLEVEL
+       fi
 
-# set up devfsd
-if [ -e /dev/.devfsd -a -x /sbin/devfsd ]; then
-        run_cmd "Starting Device Filesystem Daemon" /sbin/devfsd /dev
-fi
+       if [ -f /etc/udev/udev.conf ];then
+               . /etc/udev/udev.conf
+       fi
 
-# cpuset support (mounted unconditionally, shouldn't be a problem)
-if grep -q cpuset /proc/filesystems 2>/dev/null ; then
-    mount -n -t cpuset none /dev/cpuset
-fi
+       [ -x /sbin/start_udev ] && run_cmd "Starting udev" /sbin/start_udev
+               
+       # /dev must be also mounted before everything but only if we want use 
them ;-)
+       if is_yes "$MOUNT_DEVFS"; then
+               run_cmd "Mounting Device Filesystem" mount -n -t devfs /dev /dev
+       fi
 
-# Configure Linux kernel (initial configuration, some required modules still
-# may be missing).
-/sbin/sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
+       # set up devfsd
+       if [ -e /dev/.devfsd -a -x /sbin/devfsd ]; then
+               run_cmd "Starting Device Filesystem Daemon" /sbin/devfsd /dev
+       fi
 
-# Set the system clock.
-ARC=0
-SRM=0
-UTC=0
+       # cpuset support (mounted unconditionally, shouldn't be a problem)
+       if grep -q cpuset /proc/filesystems 2>/dev/null ; then
+           mount -n -t cpuset none /dev/cpuset
+       fi
 
-if [ -f /etc/sysconfig/clock ]; then
-       . /etc/sysconfig/clock
+       # Configure Linux kernel (initial configuration, some required modules 
still
+       # may be missing).
+       /sbin/sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
 
-       # convert old style clock config to new values
-       if [ "${CLOCKMODE}" = "GMT" ]; then
-               UTC=true
-       elif [ "${CLOCKMODE}" = "ARC" ]; then
-               ARC=true
-       fi
-fi
+       # Set the system clock.
+       ARC=0
+       SRM=0
+       UTC=0
 
-if grep "system serial" /proc/cpuinfo 2>/dev/null | grep -q MILO 2>/dev/null ; 
then
-       ARC=true
-fi
+       if [ -f /etc/sysconfig/clock ]; then
+               . /etc/sysconfig/clock
 
-CLOCKDEF=""
-CLOCKFLAGS="--hctosys"
+               # convert old style clock config to new values
+               if [ "${CLOCKMODE}" = "GMT" ]; then
+                       UTC=true
+               elif [ "${CLOCKMODE}" = "ARC" ]; then
+                       ARC=true
+               fi
+       fi
 
-if is_yes "$UTC" ; then
-       CLOCKFLAGS="$CLOCKFLAGS --utc"
-       CLOCKDEF="$CLOCKDEF (utc)"
-else
-       CLOCKFLAGS="$CLOCKFLAGS --localtime"
-       CLOCKDEF="$CLOCKDEF (local)"
-fi
+       if grep "system serial" /proc/cpuinfo 2>/dev/null | grep -q MILO 
2>/dev/null ; then
+               ARC=true
+       fi
 
-if is_yes "$ARC" ; then
-       CLOCKFLAGS="$CLOCKFLAGS -A"
-       CLOCKDEF="$CLOCKDEF (arc)"
-fi
+       CLOCKDEF=""
+       CLOCKFLAGS="--hctosys"
 
-if is_yes "$SRM" ; then
-       CLOCKFLAGS="$CLOCKFLAGS -S"
-       CLOCKDEF="$CLOCKDEF (srm)"
-fi
+       if is_yes "$UTC" ; then
+               CLOCKFLAGS="$CLOCKFLAGS --utc"
+               CLOCKDEF="$CLOCKDEF (utc)"
+       else
+               CLOCKFLAGS="$CLOCKFLAGS --localtime"
+               CLOCKDEF="$CLOCKDEF (local)"
+       fi
 
-# Check if timezone definition is available
-if [ -e /etc/localtime ] ; then
-       if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; 
then
-               show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
+       if is_yes "$ARC" ; then
+               CLOCKFLAGS="$CLOCKFLAGS -A"
+               CLOCKDEF="$CLOCKDEF (arc)"
        fi
-else
-       TIME_SETUP_DELAYED=yes
-fi
 
-# Start up swapping
-run_cmd "Activating swap partitions" swapon -a -e
+       if is_yes "$SRM" ; then
+               CLOCKFLAGS="$CLOCKFLAGS -S"
+               CLOCKDEF="$CLOCKDEF (srm)"
+       fi
 
-# Set the hostname
-run_cmd "$(nls 'Host:') ${HOSTNAME}" hostname ${HOSTNAME}
+       # Check if timezone definition is available
+       if [ -e /etc/localtime ] ; then
+               if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock 
$CLOCKFLAGS; then
+                       show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
+               fi
+       else
+               TIME_SETUP_DELAYED=yes
+       fi
 
-# Set the NIS domain name
-if [ -n "$NISDOMAIN" ]; then
-       run_cmd "$(nls 'NIS Domain:') ${NISDOMAIN}" domainname $NISDOMAIN
-else
-       domainname ""
-fi
+       # Start up swapping
+       run_cmd "Activating swap partitions" swapon -a -e
 
-# Initialize USB controllers
-usb=0
-if ! grep -iq "nousb" /proc/cmdline 2>/dev/null && ! grep -q "usb" 
/proc/devices 2>/dev/null ; then
-        aliases=$(/sbin/modprobe -c | awk '/^alias usb-controller/ { print $3 
}')
-        if [ -n "$aliases" -a "$aliases" != "off" ] ; then
-                /sbin/modprobe -k usbcore
-                for alias in $aliases ; do
-                        [ "$alias" = "off" ] && continue
-                        run_cmd "$(nls 'Initializing USB controller') 
($alias)" /sbin/modprobe $alias
-                done
-                [ $? -eq 0 -a -n "$aliases" ] && usb=1
-        fi
-       if grep -iq "usb" /proc/devices 2>/dev/null ; then
-               usb=1
+       # Initialize USB controllers
+       usb=0
+       if ! grep -iq "nousb" /proc/cmdline 2>/dev/null && ! grep -q "usb" 
/proc/devices 2>/dev/null ; then
+               aliases=$(/sbin/modprobe -c | awk '/^alias usb-controller/ { 
print $3 }')
+               if [ -n "$aliases" -a "$aliases" != "off" ] ; then
+                       /sbin/modprobe -k usbcore
+                       for alias in $aliases ; do
+                               [ "$alias" = "off" ] && continue
+                               run_cmd "$(nls 'Initializing USB controller') 
($alias)" /sbin/modprobe $alias
+                       done
+                       [ $? -eq 0 -a -n "$aliases" ] && usb=1
+               fi
+               if grep -iq "usb" /proc/devices 2>/dev/null ; then
+                       usb=1
+               fi
        fi
-fi
 
-if [ "$usb" = "1" -a ! -f /proc/bus/usb/devices ]; then
-       run_cmd "Mounting USB filesystem" mount -t usbfs usbfs /proc/bus/usb
-fi
+       if [ "$usb" = "1" -a ! -f /proc/bus/usb/devices ]; then
+               run_cmd "Mounting USB filesystem" mount -t usbfs usbfs 
/proc/bus/usb
+       fi
 
-needusbstorage=
-if [ "$usb" = "1" ]; then
-       needusbstorage=$(LC_ALL=C cat /proc/bus/usb/devices 2>/dev/null|grep -e 
"^I.*Cls=08" 2>/dev/null)
-       if [ "$(kernelverser)" -lt "002006" ]; then
-           LC_ALL=C grep -q 'hid' /proc/bus/usb/drivers 2>/dev/null || run_cmd 
"Initializing USB HID interface" modprobe hid 2> /dev/null
-           mouseoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E 
"^I.*Cls=03.*Prot=02" 2>/dev/null)
-           kbdoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E 
"^I.*Cls=03.*Prot=01" 2>/dev/null)
-           if [ -n "$kbdoutput" ]; then
-               run_cmd "Initializing USB keyboard" modprobe keybdev
-           fi
-           if [ -n "$mouseoutput" ]; then
-               run_cmd "Initializing USB mouse" modprobe mousedev
-           fi
+       needusbstorage=
+       if [ "$usb" = "1" ]; then
+               needusbstorage=$(LC_ALL=C cat /proc/bus/usb/devices 
2>/dev/null|grep -e "^I.*Cls=08" 2>/dev/null)
+               if [ "$(kernelverser)" -lt "002006" ]; then
+                   LC_ALL=C grep -q 'hid' /proc/bus/usb/drivers 2>/dev/null || 
run_cmd "Initializing USB HID interface" modprobe hid 2> /dev/null
+                   mouseoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E 
"^I.*Cls=03.*Prot=02" 2>/dev/null)
+                   kbdoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E 
"^I.*Cls=03.*Prot=01" 2>/dev/null)
+                   if [ -n "$kbdoutput" ]; then
+                       run_cmd "Initializing USB keyboard" modprobe keybdev
+                   fi
+                   if [ -n "$mouseoutput" ]; then
+                       run_cmd "Initializing USB mouse" modprobe mousedev
+                   fi
+               fi
        fi
-fi
 
-# Setup hdparm thing (if exists and is needed)
-if ! grep -iq nohdparm /proc/cmdline 2>/dev/null; then
-       [ -x /etc/rc.d/rc.hdparm ] && /etc/rc.d/rc.hdparm
-fi
+       # Setup hdparm thing (if exists and is needed)
+       if ! grep -iq nohdparm /proc/cmdline 2>/dev/null; then
+               [ -x /etc/rc.d/rc.hdparm ] && /etc/rc.d/rc.hdparm
+       fi
 
-if [ -f /fastboot ] || grep -iq "fastboot" /proc/cmdline 2>/dev/null ; then
-       fastboot=yes
-else
-       fastboot=
-fi
+       if [ -f /fastboot ] || grep -iq "fastboot" /proc/cmdline 2>/dev/null ; 
then
+               fastboot=yes
+       else
+               fastboot=
+       fi
 
-if [ -f /fsckoptions ]; then
-       fsckoptions=$(cat /fsckoptions)
-else
-       fsckoptions=''
-fi
+       if [ -f /fsckoptions ]; then
+               fsckoptions=$(cat /fsckoptions)
+       else
+               fsckoptions=''
+       fi
 
-if [ -f /forcefsck ]; then
-        fsckoptions="-f $fsckoptions"
-fi
+       if [ -f /forcefsck ]; then
+               fsckoptions="-f $fsckoptions"
+       fi
 
-_RUN_QUOTACHECK=0
-_ROOTFS_TYPE=$(grep " / " /proc/mounts 2>/dev/null | awk '{ print $3 }')
+       _RUN_QUOTACHECK=0
+       _ROOTFS_TYPE=$(grep " / " /proc/mounts 2>/dev/null | awk '{ print $3 }')
 
-if [ -z "$fastboot" -a "$_ROOTFS_TYPE" != "nfs" -a "$_ROOTFS_TYPE" != "romfs" 
]; then 
-       show "Checking root filesystem"; started
-       initlog -c "fsck -C -T -a $fsckoptions /"
+       if [ -z "$fastboot" -a "$_ROOTFS_TYPE" != "nfs" -a "$_ROOTFS_TYPE" != 
"romfs" ]; then 
+               show "Checking root filesystem"; started
+               initlog -c "fsck -C -T -a $fsckoptions /"
 
-       rc=$?
+               rc=$?
 
-       # A return of 4 or higher means there were serious problems.
-       if [ $rc -gt 3 ]; then
-               [ -e /proc/splash ] && echo "verbose" > /proc/splash
-               # don't use '\n' in nls macro !
-               echo
-               echo
-               nls "*** An error occurred during the file system check."
-               nls "*** Dropping you to a shell; the system will reboot"
-               nls "*** when you leave the shell."
-               echo
+               # A return of 4 or higher means there were serious problems.
+               if [ $rc -gt 3 ]; then
+                       [ -e /proc/splash ] && echo "verbose" > /proc/splash
+                       # don't use '\n' in nls macro !
+                       echo
+                       echo
+                       nls "*** An error occurred during the file system 
check."
+                       nls "*** Dropping you to a shell; the system will 
reboot"
+                       nls "*** when you leave the shell."
+                       echo
 
-               PS1="$(nls '(Repair filesystem)# ')"; export PS1
-               [ "$SELINUX" = "1" ] && disable_selinux
-               if is_yes "$RUN_SULOGIN_ON_ERR"; then
-                       /sbin/sulogin
-               else
-                       /bin/sh
-               fi
+                       PS1="$(nls '(Repair filesystem)# ')"; export PS1
+                       [ "$SELINUX" = "1" ] && disable_selinux
+                       if is_yes "$RUN_SULOGIN_ON_ERR"; then
+                               /sbin/sulogin
+                       else
+                               /bin/sh
+                       fi
 
-               run_cmd "Unmounting file systems" umount -a
-               mount -n -o remount,ro /
-               run_cmd "Automatic reboot in progress" reboot
-       # A return of 2 or 3 means that filesystem was repaired but we need
-       # to reboot.
-       elif [ "$rc" = "2" -o "$rc" = "3" ]; then
-               [ -e /proc/splash ] && echo "verbose" > /proc/splash
-               echo
-               nls "*** Filesystem was repaired but system needs to be"
-               nls "*** rebooted before mounting it."
-               nls "*** REBOOTING ***"
-               echo
-
-               run_cmd "Unmounting file systems" umount -a
-               mount -n -o remount,ro /
-               run_cmd "Automatic reboot in progress" reboot
-       elif [ "$rc" = "1" ]; then
-               _RUN_QUOTACHECK=1
+                       run_cmd "Unmounting file systems" umount -a
+                       mount -n -o remount,ro /
+                       run_cmd "Automatic reboot in progress" reboot
+               # A return of 2 or 3 means that filesystem was repaired but we 
need
+               # to reboot.
+               elif [ "$rc" = "2" -o "$rc" = "3" ]; then
+                       [ -e /proc/splash ] && echo "verbose" > /proc/splash
+                       echo
+                       nls "*** Filesystem was repaired but system needs to be"
+                       nls "*** rebooted before mounting it."
+                       nls "*** REBOOTING ***"
+                       echo
+
+                       run_cmd "Unmounting file systems" umount -a
+                       mount -n -o remount,ro /
+                       run_cmd "Automatic reboot in progress" reboot
+               elif [ "$rc" = "1" ]; then
+                       _RUN_QUOTACHECK=1
+               fi
        fi
-fi
 
-# Unmount the initrd, if necessary
-if LC_ALL=C grep -q /initrd /proc/mounts 2>/dev/null && ! LC_ALL=C grep -q 
/initrd/loopfs /proc/mounts 2>/dev/null ; then
-    if [ -e /initrd/dev/.devfsd ]; then
-       umount /initrd/dev
-    fi
-    umount /initrd
-    /sbin/blockdev --flushbufs /dev/ram0 >/dev/null 2>&1
-fi
-                     
-# Check for arguments 
-if grep -iq nopnp /proc/cmdline 2>/dev/null; then
-       PNP=
-else
-       PNP=yes
-fi
+       # Unmount the initrd, if necessary
+       if LC_ALL=C grep -q /initrd /proc/mounts 2>/dev/null && ! LC_ALL=C grep 
-q /initrd/loopfs /proc/mounts 2>/dev/null ; then
+           if [ -e /initrd/dev/.devfsd ]; then
+               umount /initrd/dev
+           fi
+           umount /initrd
+           /sbin/blockdev --flushbufs /dev/ram0 >/dev/null 2>&1
+       fi
+                             
+       # Check for arguments 
+       if grep -iq nopnp /proc/cmdline 2>/dev/null; then
+               PNP=
+       else
+               PNP=yes
+       fi
 
-# set up pnp and kernel pnp
-if [ -n "$PNP" ]; then
-    if is_yes "$RUN_USERPNP" && [ -x /sbin/isapnp -a -f 
/etc/isapnp/isapnp.conf ]; then
-       run_cmd "Setting up ISA PNP devices (userspace pnp)" /sbin/isapnp 
/etc/isapnp/isapnp.conf
-    fi
-    if is_yes "$RUN_KERNELPNP"; then
-       /sbin/modprobe -k isa-pnp 2> /dev/null
-       if [ -e /proc/isapnp -a -f /etc/isapnp/isapnp-kernel.conf ]; then
-           show "Setting up ISA PNP devices (kernelspace pnp)"; busy
-           grep -v "^#" /etc/isapnp/isapnp-kernel.conf 2>/dev/null 
>/proc/isapnp && (deltext; ok) || (deltext; fail)
+       # set up pnp and kernel pnp
+       if [ -n "$PNP" ]; then
+           if is_yes "$RUN_USERPNP" && [ -x /sbin/isapnp -a -f 
/etc/isapnp/isapnp.conf ]; then
+               run_cmd "Setting up ISA PNP devices (userspace pnp)" 
/sbin/isapnp /etc/isapnp/isapnp.conf
+           fi
+           if is_yes "$RUN_KERNELPNP"; then
+               /sbin/modprobe -k isa-pnp 2> /dev/null
+               if [ -e /proc/isapnp -a -f /etc/isapnp/isapnp-kernel.conf ]; 
then
+                   show "Setting up ISA PNP devices (kernelspace pnp)"; busy
+                   grep -v "^#" /etc/isapnp/isapnp-kernel.conf 2>/dev/null 
>/proc/isapnp && (deltext; ok) || (deltext; fail)
+               fi
+           fi
        fi
-    fi
-fi
 
-# Remount the root filesystem read-write
-run_cmd "Remounting root filesystem in rw mode" mount -n -o remount,rw /
+       # Remount the root filesystem read-write
+       run_cmd "Remounting root filesystem in rw mode" mount -n -o remount,rw /
 
-# Update quotas if fsck was run on /
-if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
-       run_cmd "Checking root filesystem quotas" /sbin/quotacheck -vnug /
+       # Update quotas if fsck was run on /
+       if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
+               run_cmd "Checking root filesystem quotas" /sbin/quotacheck 
-vnug /
+       fi
 fi
 
 # Clean up SELinux labels
@@ -378,22 +380,24 @@
 # Remove stale backups
 rm -f /etc/mtab~ /etc/mtab~~ /etc/cryptomtab~ /etc/cryptomtab~~
 
-# Enter root, /proc, /sys, devfs and other into mtab.
-mount -f /
-mount -f /proc
-[ -f /proc/bus/usb/devices ] && mount -f -t usbfs usbfs /proc/bus/usb
-[ -e /dev/.devfsd ] && mount -f -t devfs devfs /dev
+if ! is_yes "$VSERVER"; then
+       # Enter root, /proc, /sys, devfs and other into mtab.
+       mount -f /
+       mount -f /proc
+       [ -f /proc/bus/usb/devices ] && mount -f -t usbfs usbfs /proc/bus/usb
+       [ -e /dev/.devfsd ] && mount -f -t devfs devfs /dev
 
-if grep -q sysfs /proc/filesystems 2>/dev/null ; then
-       mount -f -t sysfs sysfs /sys
-fi
+       if grep -q sysfs /proc/filesystems 2>/dev/null ; then
+               mount -f -t sysfs sysfs /sys
+       fi
 
-if grep -q selinuxfs /proc/filesystems 2>/dev/null ; then
-       mount -f -t selinuxfs selinuxfs /selinux
-fi
+       if grep -q selinuxfs /proc/filesystems 2>/dev/null ; then
+               mount -f -t selinuxfs selinuxfs /selinux
+       fi
 
-if grep -q cpuset /proc/filesystems 2>/dev/null ; then
-    mount -n -t cpuset none /dev/cpuset
+       if grep -q cpuset /proc/filesystems 2>/dev/null ; then
+           mount -n -t cpuset none /dev/cpuset
+       fi
 fi
 
 # Remove /etc/nologin when starting system
@@ -415,328 +419,330 @@
        IN_INITLOG=""
 fi
 
-if [ ! -f /proc/modules ]; then
-       USEMODULES=
-elif ! grep -iq nomodules /proc/cmdline 2>/dev/null; then
-       USEMODULES=y
-else
-       USEMODULES=
-fi
+if ! is_yes "$VSERVER"; then
+       if [ ! -f /proc/modules ]; then
+               USEMODULES=
+       elif ! grep -iq nomodules /proc/cmdline 2>/dev/null; then
+               USEMODULES=y
+       else
+               USEMODULES=
+       fi
 
-# Adjust symlinks as necessary in /boot to keep system services from
-# spewing messages about mismatched System maps and so on.
-if is_yes "$SET_SLINKS"; then
-       if [ -L /boot/System.map -a -r /boot/System.map-`uname -r` ] ; then
-               ln -s -f System.map-`uname -r` /boot/System.map
+       # Adjust symlinks as necessary in /boot to keep system services from
+       # spewing messages about mismatched System maps and so on.
+       if is_yes "$SET_SLINKS"; then
+               if [ -L /boot/System.map -a -r /boot/System.map-`uname -r` ] ; 
then
+                       ln -s -f System.map-`uname -r` /boot/System.map
+               fi
+               if [ ! -e /boot/System.map -a -r /boot/System.map-`uname -r` ] 
; then
+                       ln -s -f System.map-`uname -r` /boot/System.map
+               fi
        fi
-       if [ ! -e /boot/System.map -a -r /boot/System.map-`uname -r` ] ; then
-               ln -s -f System.map-`uname -r` /boot/System.map
+
+       # Run depmod if RUN_DEPMOD != "no" and:
+       # a) user requested or RUN_DEPMOD="";
+       # b) modules.dep is missing
+       # c) modules.dep is older than /etc/modules.conf or /lib/modules/`uname 
-r`
+       if ! is_no "$RUN_DEPMOD" && [ -n "$USEMODULES" ]; then
+               if is_yes "$RUN_DEPMOD" || [ -z "$RUN_DEPMOD" ]; then
+                       run_cmd "Finding module dependencies" depmod -a
+               elif [ "$RUN_DEPMOD" = "ifmissing" ]; then
+                       run_cmd "Finding module dependencies" depmod -A
+               fi
        fi
-fi
 
-# Run depmod if RUN_DEPMOD != "no" and:
-# a) user requested or RUN_DEPMOD="";
-# b) modules.dep is missing
-# c) modules.dep is older than /etc/modules.conf or /lib/modules/`uname -r`
-if ! is_no "$RUN_DEPMOD" && [ -n "$USEMODULES" ]; then
-       if is_yes "$RUN_DEPMOD" || [ -z "$RUN_DEPMOD" ]; then
-               run_cmd "Finding module dependencies" depmod -a
-       elif [ "$RUN_DEPMOD" = "ifmissing" ]; then
-               run_cmd "Finding module dependencies" depmod -A
+       if [ -f /proc/sys/kernel/modprobe ]; then
+               if [ -n "$USEMODULES" ]; then
+                       sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 
2>&1
+                       sysctl -w kernel.hotplug="/sbin/hotplug" >/dev/null 2>&1
+               else
+                       # We used to set this to NULL, but that causes
+                       # 'failed to exec' messages"
+                       sysctl -w kernel.modprobe="/bin/true" >/dev/null 2>&1
+                       sysctl -w kernel.hotplug="/bin/true" >/dev/null 2>&1
+               fi
        fi
-fi
 
-if [ -f /proc/sys/kernel/modprobe ]; then
-       if [ -n "$USEMODULES" ]; then
-               sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1
-               sysctl -w kernel.hotplug="/sbin/hotplug" >/dev/null 2>&1
-       else
-               # We used to set this to NULL, but that causes
-               # 'failed to exec' messages"
-               sysctl -w kernel.modprobe="/bin/true" >/dev/null 2>&1
-               sysctl -w kernel.hotplug="/bin/true" >/dev/null 2>&1
-       fi
-fi
-
-# Load usb storage here, to match most other things
-if [ -n "$needusbstorage" ]; then
-        modprobe -k usb-storage >/dev/null 2>&1
-fi
-
-# Load firewire devices
-if ! grep -iq "nofirewire" /proc/cmdline 2>/dev/null ; then
-       aliases=$(/sbin/modprobe -c | awk '/^alias ieee1394-controller/ { print 
$3 }')
-       if [ -n "$aliases" -a "$aliases" != "off" ] ; then
-           for alias in $aliases ; do
-               [ "$alias" = "off" ] && continue
-               run_cmd "$(nls 'Initializing firewire controller') ($alias)" 
/sbin/modprobe $alias
-           done
-           LC_ALL=C grep -E "SBP2" /proc/bus/ieee1394/devices 2>/dev/null && 
/sbin/modprobe -s sbp2 > /dev/null 2>&1 
-       fi
-fi    
-    
-# Load sound modules if they need persistent DMA buffers
-if grep -q "^options sound dmabuf=1" "$MODULES_CONF" 2>/dev/null ; then
-       RETURN=0
-       alias=$(/sbin/modprobe -c | egrep -s 
"^alias[[:space:]]+sound[[:space:]]+" 2>/dev/null | awk '{ print $3 }')
-       if [ -n "$alias" -a "$alias" != "off" ] ; then
-               run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s 
$alias
-               RETURN=$?
-       fi
-       alias=$(/sbin/modprobe -c | egrep -s 
"^alias[[:space:]]+sound-slot-0[[:space:]]+" 2>/dev/null | awk '{ print $3 }')
-       if [ -n "$alias" -a "$alias" != "off" ] ; then
-               run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s 
$alias
-               RETURN=$?
-       fi
-fi
-
-# Load modules
-if [ -x /etc/rc.d/rc.modules ]; then
-       /etc/rc.d/rc.modules
-fi
-
-# Find and activate volume groups:
-# EVMS
-if [ -x /sbin/evms_activate ]; then
-    
-       if [ "$(kernelverser)" -lt "002006" ]; then
-           # Linux 2.4 core modules
-           modprobe -s -k evms > /dev/null 2>&1
-           modprobe -s -k evms_passthru > /dev/null 2>&1
-           modprobe -s -k ldev_mgr > /dev/null 2>&1
-           modprobe -s -k dos_part > /dev/null 2>&1
-       else
-           # Linux 2.6 core module
-           modprobe -s -k evmscore > /dev/null 2>&1
-       fi
-       
-       is_yes "$EVMS_GUID_PTABLE" && modprobe -s -k gpt_part >/dev/null 2>&1
-       is_yes "$EVMS_LVM" && modprobe -s -k lvm_vge >/dev/null 2>&1
-       is_yes "$EVMS_AIX" && modprobe -s -k AIXlvm_vge >/dev/null 2>&1
-       is_yes "$EVMS_OS2" && modprobe -s -k os2lvm_vge >/dev/null 2>&1
-        run_cmd "Discovering EVMS volumes" /sbin/evms_activate
-       if is_yes "$EVMS_LVM" && is_yes "$EVMS_LVM_COMPAT_NODES" ; then
-               # Link nodes for compatibility with LVM
-               if [ "echo /dev/evms/lvm/*" != '/dev/evms/lvm/*' ] ; then
-                       ln -s /dev/evms/lvm/* /dev/
-               fi
-       fi
-fi
-# LVM (keep in sync with LVM starting after RAID run!)
-if is_yes "$EVMS_LVM" || [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then
-       lvmversion=$(/sbin/vgchange --version 2>/dev/null | awk 
'{gsub("vgchange: Logical Volume Manager ",""); gsub("LVM version:     ",""); 
gsub(/\..*/,"");print $1; exit}')
-       if [ "$lvmversion" = "1" ] ; then
-               modprobe -s -k lvm-mod >/dev/null 2>&1
-               lvmignorelock=""
-       elif [ "$lvmversion" = "2" ] ; then
-               modprobe -s -k dm-mod >/dev/null 2>&1
-               lvmignorelock="--ignorelockingfailure"
-       else
-           modprobe -s -k lvm-mod >/dev/null 2>&1
-           # device mapper (2.5+ and patched 2.4)
-           modprobe -s -k dm-mod >/dev/null 2>&1
-           lvmignorelock=""
+       # Load usb storage here, to match most other things
+       if [ -n "$needusbstorage" ]; then
+               modprobe -k usb-storage >/dev/null 2>&1
        fi
-                       
-    
-       run_cmd "Scanning for LVM volume groups" /sbin/vgscan $lvmignorelock && 
\
-       run_cmd "Activating LVM volume groups" /sbin/vgchange -a y 
$lvmignorelock
-       [ "$lvmversion" = "2" ] && /sbin/vgscan --mknodes $lvmignorelock > 
/dev/null 2>&1
 
-fi
+       # Load firewire devices
+       if ! grep -iq "nofirewire" /proc/cmdline 2>/dev/null ; then
+               aliases=$(/sbin/modprobe -c | awk '/^alias ieee1394-controller/ 
{ print $3 }')
+               if [ -n "$aliases" -a "$aliases" != "off" ] ; then
+                   for alias in $aliases ; do
+                       [ "$alias" = "off" ] && continue
+                       run_cmd "$(nls 'Initializing firewire controller') 
($alias)" /sbin/modprobe $alias
+                   done
+                   LC_ALL=C grep -E "SBP2" /proc/bus/ieee1394/devices 
2>/dev/null && /sbin/modprobe -s sbp2 > /dev/null 2>&1 
+               fi
+       fi    
+           
+       # Load sound modules if they need persistent DMA buffers
+       if grep -q "^options sound dmabuf=1" "$MODULES_CONF" 2>/dev/null ; then
+               RETURN=0
+               alias=$(/sbin/modprobe -c | egrep -s 
"^alias[[:space:]]+sound[[:space:]]+" 2>/dev/null | awk '{ print $3 }')
+               if [ -n "$alias" -a "$alias" != "off" ] ; then
+                       run_cmd "$(nls 'Loading sound module') ($alias)" 
modprobe -s $alias
+                       RETURN=$?
+               fi
+               alias=$(/sbin/modprobe -c | egrep -s 
"^alias[[:space:]]+sound-slot-0[[:space:]]+" 2>/dev/null | awk '{ print $3 }')
+               if [ -n "$alias" -a "$alias" != "off" ] ; then
+                       run_cmd "$(nls 'Loading sound module') ($alias)" 
modprobe -s $alias
+                       RETURN=$?
+               fi
+       fi
 
-# Add raid devices
-if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ] || [ -f /etc/raidtab ]; then
+       # Load modules
+       if [ -x /etc/rc.d/rc.modules ]; then
+               /etc/rc.d/rc.modules
+       fi
 
-       modprobe -s md >/dev/null 2>&1
-       if [ -f /proc/mdstat ]; then
-           goraidtab=1
-           golvm=0
-           rc=0
+       # Find and activate volume groups:
+       # EVMS
+       if [ -x /sbin/evms_activate ]; then
            
-           if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ]; then
-               if (grep -qE "^([[:blank:]]|)ARRAY[[:blank:]]" /etc/mdadm.conf 
2>/dev/null); then
-                   run_cmd "Starting up RAID devices" /sbin/mdadm --assemble 
--scan
-                   rc=$?
-                   [ "$rc" -eq 0 ] && goraidtab=0 && golvm=1
+               if [ "$(kernelverser)" -lt "002006" ]; then
+                   # Linux 2.4 core modules
+                   modprobe -s -k evms > /dev/null 2>&1
+                   modprobe -s -k evms_passthru > /dev/null 2>&1
+                   modprobe -s -k ldev_mgr > /dev/null 2>&1
+                   modprobe -s -k dos_part > /dev/null 2>&1
+               else
+                   # Linux 2.6 core module
+                   modprobe -s -k evmscore > /dev/null 2>&1
                fi
-           fi
-           
-           if [ -f /etc/raidtab -a "$goraidtab" -eq 1 ]; then
                
-               for i in $(grep -v "^#" /etc/raidtab 2>/dev/null | grep 
"raiddev" 2>/dev/null | awk '{print $2}') ; do
-                   golvm=1
-                   RAIDDEV=$(basename $i)
-                   RAIDSTAT=$(grep "^$RAIDDEV : active" /proc/mdstat 
2>/dev/null)
-                   show "Starting up RAID device %s" $RAIDDEV
-                   busy
-                   if [ -z "$RAIDSTAT" ]; then
-                       # Try raidstart first...if that fails then
-                       # fall back to raid0run and if that fails too
-                       # fall back to raidadd, raidrun.
-                       RESULT=1
-                       if [ -x /sbin/raidstart ]; then
-                               /sbin/raidstart $i
-                               RESULT=$?
+               is_yes "$EVMS_GUID_PTABLE" && modprobe -s -k gpt_part 
>/dev/null 2>&1
+               is_yes "$EVMS_LVM" && modprobe -s -k lvm_vge >/dev/null 2>&1
+               is_yes "$EVMS_AIX" && modprobe -s -k AIXlvm_vge >/dev/null 2>&1
+               is_yes "$EVMS_OS2" && modprobe -s -k os2lvm_vge >/dev/null 2>&1
+               run_cmd "Discovering EVMS volumes" /sbin/evms_activate
+               if is_yes "$EVMS_LVM" && is_yes "$EVMS_LVM_COMPAT_NODES" ; then
+                       # Link nodes for compatibility with LVM
+                       if [ "echo /dev/evms/lvm/*" != '/dev/evms/lvm/*' ] ; 
then
+                               ln -s /dev/evms/lvm/* /dev/
                        fi
-                       if [ $RESULT -gt 0 -a -x /sbin/raid0run ]; then
-                               /sbin/raid0run $i
-                               RESULT=$?
-                       fi
-                       if [ $RESULT -gt 0 -a -x /sbin/raidadd -a -x 
/sbin/raidrun ]; then
-                               /sbin/raidadd $i
-                               /sbin/raidrun $i
-                               RESULT=$?
+               fi
+       fi
+       # LVM (keep in sync with LVM starting after RAID run!)
+       if is_yes "$EVMS_LVM" || [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then
+               lvmversion=$(/sbin/vgchange --version 2>/dev/null | awk 
'{gsub("vgchange: Logical Volume Manager ",""); gsub("LVM version:     ",""); 
gsub(/\..*/,"");print $1; exit}')
+               if [ "$lvmversion" = "1" ] ; then
+                       modprobe -s -k lvm-mod >/dev/null 2>&1
+                       lvmignorelock=""
+               elif [ "$lvmversion" = "2" ] ; then
+                       modprobe -s -k dm-mod >/dev/null 2>&1
+                       lvmignorelock="--ignorelockingfailure"
+               else
+                   modprobe -s -k lvm-mod >/dev/null 2>&1
+                   # device mapper (2.5+ and patched 2.4)
+                   modprobe -s -k dm-mod >/dev/null 2>&1
+                   lvmignorelock=""
+               fi
+                               
+           
+               run_cmd "Scanning for LVM volume groups" /sbin/vgscan 
$lvmignorelock && \
+               run_cmd "Activating LVM volume groups" /sbin/vgchange -a y 
$lvmignorelock
+               [ "$lvmversion" = "2" ] && /sbin/vgscan --mknodes 
$lvmignorelock > /dev/null 2>&1
+
+       fi
+
+       # Add raid devices
+       if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ] || [ -f /etc/raidtab ]; then
+
+               modprobe -s md >/dev/null 2>&1
+               if [ -f /proc/mdstat ]; then
+                   goraidtab=1
+                   golvm=0
+                   rc=0
+                   
+                   if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ]; then
+                       if (grep -qE "^([[:blank:]]|)ARRAY[[:blank:]]" 
/etc/mdadm.conf 2>/dev/null); then
+                           run_cmd "Starting up RAID devices" /sbin/mdadm 
--assemble --scan
+                           rc=$?
+                           [ "$rc" -eq 0 ] && goraidtab=0 && golvm=1
                        fi
-                       if [ $RESULT -gt 0 ]; then
-                               rc=1
-                               fail
-                       else
+                   fi
+                   
+                   if [ -f /etc/raidtab -a "$goraidtab" -eq 1 ]; then
+                       
+                       for i in $(grep -v "^#" /etc/raidtab 2>/dev/null | grep 
"raiddev" 2>/dev/null | awk '{print $2}') ; do
+                           golvm=1
+                           RAIDDEV=$(basename $i)
+                           RAIDSTAT=$(grep "^$RAIDDEV : active" /proc/mdstat 
2>/dev/null)
+                           show "Starting up RAID device %s" $RAIDDEV
+                           busy
+                           if [ -z "$RAIDSTAT" ]; then
+                               # Try raidstart first...if that fails then
+                               # fall back to raid0run and if that fails too
+                               # fall back to raidadd, raidrun.
+                               RESULT=1
+                               if [ -x /sbin/raidstart ]; then
+                                       /sbin/raidstart $i
+                                       RESULT=$?
+                               fi
+                               if [ $RESULT -gt 0 -a -x /sbin/raid0run ]; then
+                                       /sbin/raid0run $i
+                                       RESULT=$?
+                               fi
+                               if [ $RESULT -gt 0 -a -x /sbin/raidadd -a -x 
/sbin/raidrun ]; then
+                                       /sbin/raidadd $i
+                                       /sbin/raidrun $i
+                                       RESULT=$?
+                               fi
+                               if [ $RESULT -gt 0 ]; then
+                                       rc=1
+                                       fail
+                               else
+                                       ok
+                               fi
+                           else
                                ok
-                       fi
-                   else
-                       ok
+                           fi
+                       done
                    fi
-               done
-           fi
 
-           # A non-zero return means there were problems
-           if [ $rc -gt 0 ]; then
-               [ -e /proc/splash ] && echo "verbose" > /proc/splash
-               show "Starting up RAID devices"; fail
-               echo
-               echo
-               nls "*** An error occurred during the RAID startup."
-               nls "*** Dropping you to a shell; the system will reboot"
-               nls "*** when you leave the shell."
-               echo
-
-               PS1="$(nls '(RAID Repair)# ')"; export PS1
-               [ "$SELINUX" = "1" ] && disable_selinux
-               if is_yes "$RUN_SULOGIN_ON_ERR"; then
-                       /sbin/sulogin
-               else
-                       /bin/sh
-               fi
+                   # A non-zero return means there were problems
+                   if [ $rc -gt 0 ]; then
+                       [ -e /proc/splash ] && echo "verbose" > /proc/splash
+                       show "Starting up RAID devices"; fail
+                       echo
+                       echo
+                       nls "*** An error occurred during the RAID startup."
+                       nls "*** Dropping you to a shell; the system will 
reboot"
+                       nls "*** when you leave the shell."
+                       echo
+
+                       PS1="$(nls '(RAID Repair)# ')"; export PS1
+                       [ "$SELINUX" = "1" ] && disable_selinux
+                       if is_yes "$RUN_SULOGIN_ON_ERR"; then
+                               /sbin/sulogin
+                       else
+                               /bin/sh
+                       fi
 
-               run_cmd "Unmounting file systems" umount -a
-               run_cmd "Remounting root filesystem in ro mode" mount -n -o 
remount,ro /
-               run_cmd "Automatic reboot in progress" reboot
-           fi
-           # LVM on RAID (keep in sync with LVM setting few lines above)
-           if [ "$golvm" -eq "1" ]; then
-               if is_yes "$EVMS_LVM" || [ -x /sbin/vgscan -a -x /sbin/vgchange 
]; then
-                   run_cmd "Scanning for LVM volume groups (on RAID)" 
/sbin/vgscan $lvmignorelock && \
-                           run_cmd "Activating LVM volume groups (on RAID)" 
/sbin/vgchange -a y $lvmignorelock
-                   [ "$lvmversion" = "2" ] && /sbin/vgscan --mknodes 
$lvmignorelock > /dev/null 2>&1
+                       run_cmd "Unmounting file systems" umount -a
+                       run_cmd "Remounting root filesystem in ro mode" mount 
-n -o remount,ro /
+                       run_cmd "Automatic reboot in progress" reboot
+                   fi
+                   # LVM on RAID (keep in sync with LVM setting few lines 
above)
+                   if [ "$golvm" -eq "1" ]; then
+                       if is_yes "$EVMS_LVM" || [ -x /sbin/vgscan -a -x 
/sbin/vgchange ]; then
+                           run_cmd "Scanning for LVM volume groups (on RAID)" 
/sbin/vgscan $lvmignorelock && \
+                                   run_cmd "Activating LVM volume groups (on 
RAID)" /sbin/vgchange -a y $lvmignorelock
+                           [ "$lvmversion" = "2" ] && /sbin/vgscan --mknodes 
$lvmignorelock > /dev/null 2>&1
+                       fi
+                   fi
+                   show "Starting up RAID devices"; ok
                fi
-           fi
-           show "Starting up RAID devices"; ok
        fi
-fi
 
-_RUN_QUOTACHECK=0
-# Check filesystems
-if [ -z "$fastboot" ] && ! grep -q nofsck /proc/cmdline 2>/dev/null; then
-       rc_splash "fsck start"
-       show "Checking filesystems"; started
-       initlog -c "fsck -C -T -R -A -a $fsckoptions"
-
-       rc=$?
-
-       # A return of 2 or higher means there were serious problems
-       if [ $rc -gt 1 ]; then
-               [ -e /proc/splash ] && echo "verbose" > /proc/splash
-               echo
-               echo
-               nls "*** An error occurred during the file system check."
-               nls "*** Dropping you to a shell; the system will reboot"
-               nls "*** when you leave the shell."
-               echo
-
-               PS1="$(nls '(Repair filesystem)# ')"; export PS1
-               [ "$SELINUX" = "1" ] && disable_selinux
-               if is_yes "$RUN_SULOGIN_ON_ERR"; then
-                       /sbin/sulogin
-               else
-                       /bin/sh
-               fi
+       _RUN_QUOTACHECK=0
+       # Check filesystems
+       if [ -z "$fastboot" ] && ! grep -q nofsck /proc/cmdline 2>/dev/null; 
then
+               rc_splash "fsck start"
+               show "Checking filesystems"; started
+               initlog -c "fsck -C -T -R -A -a $fsckoptions"
+
+               rc=$?
+
+               # A return of 2 or higher means there were serious problems
+               if [ $rc -gt 1 ]; then
+                       [ -e /proc/splash ] && echo "verbose" > /proc/splash
+                       echo
+                       echo
+                       nls "*** An error occurred during the file system 
check."
+                       nls "*** Dropping you to a shell; the system will 
reboot"
+                       nls "*** when you leave the shell."
+                       echo
+
+                       PS1="$(nls '(Repair filesystem)# ')"; export PS1
+                       [ "$SELINUX" = "1" ] && disable_selinux
+                       if is_yes "$RUN_SULOGIN_ON_ERR"; then
+                               /sbin/sulogin
+                       else
+                               /bin/sh
+                       fi
 
-               run_cmd "Unmounting file systems" umount -a
-               run_cmd "Remounting root filesystem in ro mode" mount -n -o 
remount,ro /
-               run_cmd "Automatic reboot in progress" reboot
-       elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
-               _RUN_QUOTACHECK=1
-       fi
-       rc_splash "fsck stop"
-fi
-
-# Mount all other filesystems (except for NFS and /proc, which is already
-# mounted). Contrary to standard usage,
-# filesystems are NOT unmounted in single user mode.
-
-run_cmd "Mounting local filesystems" mount -a -t nonfs,smbfs,ncpfs,proc,cifs 
-O no_netdev
-
-# Now do some workaround - encrypted filesystems couldn't have been fsck-ed
-# before mount - that's where the password is entered.
-# mount is buggy - when remounting loopback filesystem, loop=XXX
-# option is removed from /etc/mtab
-if [ -z "$fastboot" ] && grep "^[^#].*encryption=" /etc/fstab 2>/dev/null | 
grep -v -q "noauto" 2>/dev/null; then
-       show "Checking encrypted filesystems"; started
-       LOOPLIST="$(awk '
-       FILENAME=="/proc/mounts" {
-               TAB[$2]=$1;
-       }
-       FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && 
/[^a-zA-Z_]ro[^a-zA-Z_]/ {
-               if ($2 in TAB){print TAB[$2];}
-       }
-       FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! 
/[^a-zA-Z_]ro[^a-zA-Z_]/ {
-               if ($2 in TAB){print TAB[$2];}
-               sub("loop(=[^,]*)?","loop=" TAB[$2] ",ro",$4);
-               cmd="mount " $2 " -o remount," $4;
-               system(cmd);
-       }
-       ' /proc/mounts /etc/fstab)"
-       initlog -c "fsck -T -C -a $fsckoptions $LOOPLIST"
-       rc=$?
-
-       # A return of 2 or higher means there were serious problems.
-       if [ $rc -gt 1 ]; then
-               [ -e /proc/splash ] && echo "verbose" > /proc/splash
-               echo
-               echo
-               nls "*** An error occurred during the file system check."
-               nls "*** Dropping you to a shell; the system will reboot"
-               nls "*** when you leave the shell."
-               echo
-
-               PS1="`nls '(Repair filesystem)# '`"; export PS1
-               [ "$SELINUX" = "1" ] && disable_selinux
-               if is_yes "$RUN_SULOGIN_ON_ERR"; then
-                       /sbin/sulogin
-               else
-                       /bin/sh
+                       run_cmd "Unmounting file systems" umount -a
+                       run_cmd "Remounting root filesystem in ro mode" mount 
-n -o remount,ro /
+                       run_cmd "Automatic reboot in progress" reboot
+               elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
+                       _RUN_QUOTACHECK=1
                fi
+               rc_splash "fsck stop"
+       fi
 
-               run_cmd "Unmounting file systems" umount -a
-               run_cmd "Remounting root filesystem in ro mode" mount -n -o 
remount,ro /
-               run_cmd "Automatic reboot in progress" reboot
-       elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
-               _RUN_QUOTACHECK=1
-       fi
-       
-       show "Remounting encrypted filesystems back in rw mode"; busy
-       awk '
-       FILENAME=="/proc/mounts" {
-               TAB[$2]=$1;
-       }
-       FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! 
/[^a-zA-Z_]ro[^a-zA-Z_]/ {
-               sub("loop(=[^,]*)?","loop=" TAB[$2] ",rw",$4);
-               cmd="mount " $2 " -o remount," $4;
-               system(cmd);
-       }
-       ' /proc/mounts /etc/fstab
-       ok
+       # Mount all other filesystems (except for NFS and /proc, which is 
already
+       # mounted). Contrary to standard usage,
+       # filesystems are NOT unmounted in single user mode.
+
+       run_cmd "Mounting local filesystems" mount -a -t 
nonfs,smbfs,ncpfs,proc,cifs -O no_netdev
+
+       # Now do some workaround - encrypted filesystems couldn't have been 
fsck-ed
+       # before mount - that's where the password is entered.
+       # mount is buggy - when remounting loopback filesystem, loop=XXX
+       # option is removed from /etc/mtab
+       if [ -z "$fastboot" ] && grep "^[^#].*encryption=" /etc/fstab 
2>/dev/null | grep -v -q "noauto" 2>/dev/null; then
+               show "Checking encrypted filesystems"; started
+               LOOPLIST="$(awk '
+               FILENAME=="/proc/mounts" {
+                       TAB[$2]=$1;
+               }
+               FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && 
/[^a-zA-Z_]ro[^a-zA-Z_]/ {
+                       if ($2 in TAB){print TAB[$2];}
+               }
+               FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! 
/[^a-zA-Z_]ro[^a-zA-Z_]/ {
+                       if ($2 in TAB){print TAB[$2];}
+                       sub("loop(=[^,]*)?","loop=" TAB[$2] ",ro",$4);
+                       cmd="mount " $2 " -o remount," $4;
+                       system(cmd);
+               }
+               ' /proc/mounts /etc/fstab)"
+               initlog -c "fsck -T -C -a $fsckoptions $LOOPLIST"
+               rc=$?
+
+               # A return of 2 or higher means there were serious problems.
+               if [ $rc -gt 1 ]; then
+                       [ -e /proc/splash ] && echo "verbose" > /proc/splash
+                       echo
+                       echo
+                       nls "*** An error occurred during the file system 
check."
+                       nls "*** Dropping you to a shell; the system will 
reboot"
+                       nls "*** when you leave the shell."
+                       echo
+
+                       PS1="`nls '(Repair filesystem)# '`"; export PS1
+                       [ "$SELINUX" = "1" ] && disable_selinux
+                       if is_yes "$RUN_SULOGIN_ON_ERR"; then
+                               /sbin/sulogin
+                       else
+                               /bin/sh
+                       fi
+
+                       run_cmd "Unmounting file systems" umount -a
+                       run_cmd "Remounting root filesystem in ro mode" mount 
-n -o remount,ro /
+                       run_cmd "Automatic reboot in progress" reboot
+               elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
+                       _RUN_QUOTACHECK=1
+               fi
+               
+               show "Remounting encrypted filesystems back in rw mode"; busy
+               awk '
+               FILENAME=="/proc/mounts" {
+                       TAB[$2]=$1;
+               }
+               FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! 
/[^a-zA-Z_]ro[^a-zA-Z_]/ {
+                       sub("loop(=[^,]*)?","loop=" TAB[$2] ",rw",$4);
+                       cmd="mount " $2 " -o remount," $4;
+                       system(cmd);
+               }
+               ' /proc/mounts /etc/fstab
+               ok
+       fi
 fi
 
 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
@@ -755,26 +761,28 @@
        /etc/rc.d/rc.acct start
 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
-               show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
+if ! is_yes "$VSERVER"; then
+       # 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
+                       show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
+               fi
+       fi
+
+       # Initialize the serial ports
+       if [ -f /etc/rc.d/rc.serial ]; then
+               . /etc/rc.d/rc.serial
        fi
-fi
 
-# Initialize the serial ports
-if [ -f /etc/rc.d/rc.serial ]; then
-       . /etc/rc.d/rc.serial
-fi
+       if [ -f /proc/sys/kernel/panic -a "$PANIC_REBOOT_TIME" -gt "0" ]; then
+               show 'Setting %s seconds for kernel reboot after panic' 
"$PANIC_REBOOT_TIME"; busy
+               if (sysctl -w kernel.panic=$PANIC_REBOOT_TIME >/dev/null 2>&1); 
then ok; else fail; fi
+       fi
 
-if [ -f /proc/sys/kernel/panic -a "$PANIC_REBOOT_TIME" -gt "0" ]; then
-       show 'Setting %s seconds for kernel reboot after panic' 
"$PANIC_REBOOT_TIME"; busy
-       if (sysctl -w kernel.panic=$PANIC_REBOOT_TIME >/dev/null 2>&1); then 
ok; else fail; fi
+       # ... and here finish configuring parameters
+       /sbin/sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
 fi
 
-# ... and here finish configuring parameters
-/sbin/sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
-
 # Clean up /.
 rm -f /fastboot /fsckoptions /forcefsck /halt /poweroff
 
@@ -837,19 +845,21 @@
 # There could be a new kernel version. Remove old psdevtab database
 rm -f /etc/psdevtab
 
-# Now that we have all of our basic modules loaded and the kernel going,
-# let's dump the syslog ring somewhere so we can find it later
-dmesg -s 131072 > /var/log/dmesg
-i=5
-while [ $i -ge 0 ]; do
-        if [ -f /var/log/dmesg.$i ]; then
-            chmod 0600 /var/log/dmesg.$i
-            mv -f /var/log/dmesg.$i /var/log/dmesg.$(($i+1))
-        fi
-        i=$(($i-1))
-done
-cp -f /var/log/dmesg /var/log/dmesg.0
-chmod 0600 /var/log/dmesg /var/log/dmesg.0
+if ! is_yes "$VSERVER"; then
+       # Now that we have all of our basic modules loaded and the kernel going,
+       # let's dump the syslog ring somewhere so we can find it later
+       dmesg -s 131072 > /var/log/dmesg
+       i=5
+       while [ $i -ge 0 ]; do
+               if [ -f /var/log/dmesg.$i ]; then
+                   chmod 0600 /var/log/dmesg.$i
+                   mv -f /var/log/dmesg.$i /var/log/dmesg.$(($i+1))
+               fi
+               i=$(($i-1))
+       done
+       cp -f /var/log/dmesg /var/log/dmesg.0
+       chmod 0600 /var/log/dmesg /var/log/dmesg.0
+fi
 
 kill -TERM $(/sbin/pidof getkey) >/dev/null 2>&1
 } &
@@ -860,4 +870,4 @@
 echo
 
 # This must be last line !
-# vi:syntax=sh:ts=8:sw=4
+# vi:syntax=sh
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to