[ -r /etc/sysconfig/system ] && . /etc/sysconfig/system
[ -r /etc/sysconfig/bootsplash ] && . /etc/sysconfig/bootsplash
-if [ -z "$VSERVER" -o "$VSERVER" = "detect" ]; then
- {
- while read _f _ctx; do
- [ "$_f" = "VxID:" -o "$_f" = "s_context:" ] && break
- done </proc/self/status
- } 2>/dev/null
- if [ -z "$_ctx" -o "$_ctx" = "0" ]; then
- VSERVER=no
- else
- VSERVER=yes
- fi
- unset _f _ctx
-fi
-
-# VSERVER_ISOLATION_NET = isolation only inside of vserver guests
-if [ -z "$VSERVER_ISOLATION_NET" -o "$VSERVER_ISOLATION_NET" = "detect" ]; then
- VSERVER_ISOLATION_NET=no
- if [ "$VSERVER" = "yes" ]; then
- if [ -f /proc/self/nsproxy ]; then
- # older kernels
- {
- while read _t _data; do
- [ "$_t" = "net:" ] && break
- done < /proc/self/nsproxy
- } 2> /dev/null
- if [ "${_data##*\(}" = "I)" ]; then
- VSERVER_ISOLATION_NET=yes
- fi
- elif [ -f /proc/self/ninfo ]; then
- # newer kernels
- {
- while read _t _data; do
- [ "$_t" = "NCaps:" ] && break
- done < /proc/self/ninfo
- } 2> /dev/null
- if [ "${_t}" = "NCaps:" ]; then
- VSERVER_ISOLATION_NET=yes
- fi
- else
- # assume (very?) old kernel mode
- VSERVER_ISOLATION_NET=yes
- fi
- unset _f _data
- fi
-fi
-
# we need to know in functions if we were called from a terminal
if [ -z "$ISATTY" ]; then
[ -t ] && ISATTY=yes || ISATTY=no
rc_splash() {
local action="$1"
- if ! is_no "$BOOT_SPLASH" && ! is_yes "$VSERVER"; then
+ if ! is_no "$BOOT_SPLASH"; then
[ -x /bin/splash ] && /bin/splash "$action"
fi
# - inside chroot get only those processes, which are inside chroot.
# - don't filter out pids which do not have corresponding running processes (process died etc)
# (note: some processes like named are chrooted but run outside chroot)
-# - do nothing inside vserver
filter_chroot() {
# no pids, exit early
[ $# -eq 0 ] && return
pids=$(filter_ns "$@") && set -- "$pids"
fi
- if is_yes "$VSERVER"; then
- echo $@
- return
- fi
-
if [ $# -lt 1 -o ! -d /proc/1 ]; then
echo $@
return
. /etc/rc.d/init.d/cryptsetup
. /etc/sysconfig/network
-if is_yes "$VSERVER" || [[ "$container" = lxc* ]]; then
+if [[ "$container" = lxc* ]]; then
exit 0
fi
# See how we were called.
case "$1" in
start)
- if is_yes "$VSERVER_ISOLATION_NET"; then
- exit 0
- fi
start
;;
stop)
- if is_yes "$VSERVER_ISOLATION_NET"; then
- exit 0
- fi
stop
;;
restart)
- if is_yes "$VSERVER_ISOLATION_NET"; then
- exit 0
- fi
stop
start
;;
reload)
- if is_yes "$VSERVER_ISOLATION_NET"; then
- exit 0
- fi
start
;;
status)
# See how we were called.
case "$1" in
start)
- if is_yes "$VSERVER_ISOLATION_NET"; then
- touch /var/lock/subsys/network
- else
- start
- fi
+ start
;;
start_init)
network_init
rm -f /var/lock/subsys/network
;;
stop)
- if is_yes "$VSERVER_ISOLATION_NET"; then
- rm -f /var/lock/subsys/network >/dev/null 2>&1
- else
- stop
- fi
+ stop
;;
status)
;;
reload)
- if is_yes "$VSERVER_ISOLATION_NET"; then
- exit 0
- fi
shift
reload ${1:+"$@"}
;;
restart)
- if is_yes "$VSERVER_ISOLATION_NET"; then
- exit 0
- fi
-
stop
start
;;
# Source function library.
. /etc/rc.d/init.d/functions
-# do nothing in vserver
-if is_yes "$VSERVER"; then
- return
-fi
-
random_seed=/var/run/random-seed
poolfile=/proc/sys/kernel/random/poolsize
# virtual console, and send messages to /dev/console
# (it can be serial console too)
if [ "$COLUMNS" -gt 0 ]; then
- if [ "$argv2" != "chroot" ] && ! is_yes "$VSERVER" && \
+ if [ "$argv2" != "chroot" ] && \
[ "$runlevel" = "0" -o "$runlevel" = "6" ]; then
CONSOLE=/dev/tty1
[ -x /usr/bin/chvt ] && /usr/bin/chvt 1 && echo > $CONSOLE
# See if we want to be in user confirmation mode
if [ "$previous" = "N" ]; then
- if ! is_yes "$VSERVER" && grep -qi confirm /proc/cmdline >/dev/null 2>/dev/null \
+ if grep -qi confirm /proc/cmdline >/dev/null 2>/dev/null \
|| [ -f /var/run/confirm ]; then
rm -f /var/run/confirm
CONFIRM="yes"
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 2>/dev/null
# Write to wtmp file before unmounting /var
halt -w
-if ! is_yes "$VSERVER"; then
- # Turn off swap, then unmount file systems.
- run_cmd "Turning off swap" swapoff -a
+# Turn off swap, then unmount file systems.
+run_cmd "Turning off swap" swapoff -a
- [ -x /etc/rc.d/rc.acct ] && /etc/rc.d/rc.acct stop
+[ -x /etc/rc.d/rc.acct ] && /etc/rc.d/rc.acct stop
- if [ -x /sbin/quotaoff ]; then
- run_cmd "Turning off quotas for local filesystems" /sbin/quotaoff -a
- fi
+if [ -x /sbin/quotaoff ]; then
+ run_cmd "Turning off quotas for local filesystems" /sbin/quotaoff -a
+fi
+
+# grab kexec_loaded state before we umount /sys
+kexec_loaded=`cat /sys/kernel/kexec_loaded 2>/dev/null`
- # grab kexec_loaded state before we umount /sys
- kexec_loaded=`cat /sys/kernel/kexec_loaded 2>/dev/null`
+# Unmount file systems, killing processes if we have to.
+sig=-15
+retry=3
+force=
+if [ -z "$UMOUNT_IGNORE" ]; then
+ UMOUNT_IGNORE="/"
+else
+ UMOUNT_IGNORE="/ $UMOUNT_IGNORE"
+fi
+remaining=$(awk -v ig="^($UMOUNT_IGNORE)$" 'BEGIN { gsub(/[\t ]+/, "|", ig); } \
+ $3 !~ /^(proc|loopfs|devpts|devtmpfs|shm|iso9660|ramfs|tmpfs|sysfs|securityfs|squashfs)$/ \
+ && $1 !~ /^(none|\/dev\/root)$/ \
+ && $2 !~ ig {print $2}' /proc/mounts)
+while [ -n "$remaining" -a "$retry" -gt 0 ]; do
+ show "Unmounting file systems"; busy
+ ERRORS=$(umount -a $force -t noproc 2>&1); rc=$?
+
+ # we might had unmounted /usr, recheck $TPUT availability
+ # but well. we need tput only for show() and busy() (ok() and fail() messages are already cached)
+ # TODO: look ahead the messages?
+ if is_yes "$TPUT"; then
+ TPUT=
+ rc_gettext_init
+ fi
- # Unmount file systems, killing processes if we have to.
- sig=-15
- retry=3
- force=
- if [ -z "$UMOUNT_IGNORE" ]; then
- UMOUNT_IGNORE="/"
+ if [ $rc = 0 ]; then
+ ok
else
- UMOUNT_IGNORE="/ $UMOUNT_IGNORE"
+ fail
+ [ -n "$ERRORS" ] && echo "$ERRORS"
fi
+
+ sleep 2
remaining=$(awk -v ig="^($UMOUNT_IGNORE)$" 'BEGIN { gsub(/[\t ]+/, "|", ig); } \
$3 !~ /^(proc|loopfs|devpts|devtmpfs|shm|iso9660|ramfs|tmpfs|sysfs|securityfs|squashfs)$/ \
&& $1 !~ /^(none|\/dev\/root)$/ \
&& $2 !~ ig {print $2}' /proc/mounts)
- while [ -n "$remaining" -a "$retry" -gt 0 ]; do
- show "Unmounting file systems"; busy
- ERRORS=$(umount -a $force -t noproc 2>&1); rc=$?
-
- # we might had unmounted /usr, recheck $TPUT availability
- # but well. we need tput only for show() and busy() (ok() and fail() messages are already cached)
- # TODO: look ahead the messages?
- if is_yes "$TPUT"; then
- TPUT=
- rc_gettext_init
- fi
-
- if [ $rc = 0 ]; then
- ok
- else
- fail
- [ -n "$ERRORS" ] && echo "$ERRORS"
- fi
-
- sleep 2
- remaining=$(awk -v ig="^($UMOUNT_IGNORE)$" 'BEGIN { gsub(/[\t ]+/, "|", ig); } \
- $3 !~ /^(proc|loopfs|devpts|devtmpfs|shm|iso9660|ramfs|tmpfs|sysfs|securityfs|squashfs)$/ \
- && $1 !~ /^(none|\/dev\/root)$/ \
- && $2 !~ ig {print $2}' /proc/mounts)
- [ -z "$remaining" ] && break
- 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 [ -x /sbin/vgchange ]; then
- lvmversion=$(LC_ALL=C /sbin/vgchange --version 2>/dev/null | awk '/LVM version:/{if ($3 >= 2) print "2"}')
- if [ "$lvmversion" = "2" ]; then
- lvmsysinit="--sysinit"
- else
- lvmsysinit=""
- fi
- /sbin/vgchange -a n $lvmsysinit > /dev/null 2>&1
- fi
+ [ -z "$remaining" ] && break
+ fuser -k -m $sig $remaining > /dev/null
+ sleep 5
+ retry=$(($retry-1))
+ sig=-9
+ force="-f"
+done
- if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ]; then
- if grep -qE "^([[:blank:]]|)ARRAY[[:blank:]]" /etc/mdadm.conf 2>/dev/null; then
- /sbin/mdadm --stop --scan > /dev/null 2>&1
- rc=$?
- fi
- fi
+run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
- 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
+if [ -x /sbin/vgchange ]; then
+ lvmversion=$(LC_ALL=C /sbin/vgchange --version 2>/dev/null | awk '/LVM version:/{if ($3 >= 2) print "2"}')
+ if [ "$lvmversion" = "2" ]; then
+ lvmsysinit="--sysinit"
else
- fail
+ lvmsysinit=""
fi
- _rebootwhat="system"
+ /sbin/vgchange -a n $lvmsysinit > /dev/null 2>&1
+fi
+
+if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ]; then
+ if grep -qE "^([[:blank:]]|)ARRAY[[:blank:]]" /etc/mdadm.conf 2>/dev/null; then
+ /sbin/mdadm --stop --scan > /dev/null 2>&1
+ rc=$?
+ fi
+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
- _rebootwhat="vserver"
+ fail
fi
+_rebootwhat="system"
if [ -f /etc/crypttab ] && ! is_empty_file /etc/crypttab; then
. /etc/rc.d/init.d/cryptsetup
is_yes "$AUTOSWAP" && enable_autoswap
}
-# Remove duplicate entries from mtab (for vserver guest use only)
-clean_vserver_mtab() {
- > /etc/mtab.clean
- while read device mountpoint line; do
- grep -qs "$mountpoint" /etc/mtab.clean || \
- echo "$device $mountpoint $line" >> /etc/mtab.clean
- done < /etc/mtab
- cat /etc/mtab.clean > /etc/mtab
- rm -f /etc/mtab.clean
-}
-
# Loads modules from /etc/modules, /etc/modules.X.Y and /etc/modules.X.Y.Z
load_kernel_modules() {
local modules_file=$1
RC_BOOTLOG=
fi
-if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
+if [[ "$container" != lxc* ]]; then
# we need /proc mounted before everything
is_fsmounted proc /proc || mount -n /proc || mount -n -o gid=17,hidepid=2 -t proc /proc /proc
domainname ""
fi
-if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
+if [[ "$container" != lxc* ]]; then
# Set console loglevel
if [ -n "$CONSOLE_LOGLEVEL" ]; then
dmesg -n $CONSOLE_LOGLEVEL
IN_INITLOG=""
fi
-if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
+if [[ "$container" != lxc* ]]; then
# Clear mtab
> /etc/mtab
[ -f /etc/cryptomtab ] && > /etc/cryptomtab
killall -IO blogd
fi
- clean_vserver_mtab
fi
is_yes "$SELINUX" && [ -f /.autorelabel ] && relabel_selinux
test -d /var/run/netreport || mkdir -m 770 /var/run/netreport
-if ! is_yes "$VSERVER"; then
- enable_swap
+enable_swap
- # If a SCSI tape has been detected, load the st module unconditionally
- # since many SCSI tapes don't deal well with st being loaded and unloaded
- if [ -f /proc/scsi/scsi ] && grep -q 'Type: Sequential-Access' /proc/scsi/scsi 2>/dev/null ; then
- if grep -qv ' 9 st' /proc/devices 2>/dev/null; then
- if [ -n "$USEMODULES" ] ; then
- # Try to load the module. If it fails, ignore it...
- insmod -p st >/dev/null 2>&1 && modprobe -s st
- fi
+# If a SCSI tape has been detected, load the st module unconditionally
+# since many SCSI tapes don't deal well with st being loaded and unloaded
+if [ -f /proc/scsi/scsi ] && grep -q 'Type: Sequential-Access' /proc/scsi/scsi 2>/dev/null ; then
+ if grep -qv ' 9 st' /proc/devices 2>/dev/null; then
+ if [ -n "$USEMODULES" ] ; then
+ # Try to load the module. If it fails, ignore it...
+ insmod -p st >/dev/null 2>&1 && modprobe -s st
fi
fi
+fi
- # 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
- mode=0600
- if [ "$(cat /proc/sys/kernel/dmesg_restrict)" = 0 ]; then
- mode=0644
- fi
- dmesg --raw > /var/log/dmesg
- chmod $mode /var/log/dmesg
- i=5
- while [ $i -ge 0 ]; do
- if [ -f /var/log/dmesg.$i ]; then
- mv -f /var/log/dmesg.$i /var/log/dmesg.$(($i+1))
- fi
- i=$(($i-1))
- done
- cp -pf /var/log/dmesg /var/log/dmesg.0
+# 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
+mode=0600
+if [ "$(cat /proc/sys/kernel/dmesg_restrict)" = 0 ]; then
+ mode=0644
fi
+dmesg --raw > /var/log/dmesg
+chmod $mode /var/log/dmesg
+i=5
+while [ $i -ge 0 ]; do
+ if [ -f /var/log/dmesg.$i ]; then
+ mv -f /var/log/dmesg.$i /var/log/dmesg.$(($i+1))
+ fi
+ i=$(($i-1))
+done
+cp -pf /var/log/dmesg /var/log/dmesg.0
if ! is_no "$RC_PROMPT"; then
while :; do
fi
} &
-# /proc extra check if the background process we just spawned is still running,
-# as in case of vserver bootup it finishes quite instantly.
+# /proc extra check if the background process we just spawned is still running
+# as it may finish quite instantly.
if ! is_no "$RC_PROMPT" && [ -d /proc/$! ]; then
/sbin/getkey i && touch /var/run/confirm
touch /var/run/getkey_done
# Enable cpusets support?
CPUSETS=no
-# Enable this system as vserver guest (yes/no/detect)
-VSERVER=detect
-
-# Vserver isolation only networking inside of guest (yes/no/detect)
-VSERVER_ISOLATION_NET=detect
-
# Enable selinux support (yes/no/detect)
# 'yes' behaves as 'detect'
SELINUX=detect