]> TLD Linux GIT Repositories - rc-scripts.git/commitdiff
- drop unused vserver stuff
authorMarcin Krol <hawk@tld-linux.org>
Tue, 21 May 2024 16:43:46 +0000 (18:43 +0200)
committerMarcin Krol <hawk@tld-linux.org>
Tue, 21 May 2024 16:43:46 +0000 (18:43 +0200)
lib/functions
rc.d/init.d/netfs
rc.d/init.d/network
rc.d/init.d/random
rc.d/rc
rc.d/rc.shutdown
rc.d/rc.sysinit
sysconfig/system

index 8f08dc62283bec1b0699c90d08c63f520d60033b..012f59c1faab52b55a7034023bb555162202fce4 100644 (file)
@@ -59,52 +59,6 @@ CCHARS="$WHITE"              # Color of these characters (look at /etc/sysconfig/init-colors
 [ -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
@@ -358,7 +312,7 @@ nls() {
 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
 
@@ -472,7 +426,6 @@ checkpid() {
 # - 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
@@ -484,11 +437,6 @@ filter_chroot() {
                pids=$(filter_ns "$@") && set -- "$pids"
        fi
 
-       if is_yes "$VSERVER"; then
-               echo $@
-               return
-       fi
-
        if [ $# -lt 1 -o ! -d /proc/1 ]; then
                echo $@
                return
index ab00e6dda4ccd81b0d67cc021abf703a613a5501..19738b780a395d0025a96d73bd2628d9f59ec6cb 100755 (executable)
@@ -15,7 +15,7 @@
 . /etc/rc.d/init.d/cryptsetup
 . /etc/sysconfig/network
 
-if is_yes "$VSERVER" || [[ "$container" = lxc* ]]; then
+if [[ "$container" = lxc* ]]; then
        exit 0
 fi
 
@@ -173,28 +173,16 @@ RETVAL=0
 # 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)
index b44e29119d96f4d1a45fa747cd5d1d8c82b55717..cf670a74a19899f20252996e10267a07236307d9 100755 (executable)
@@ -356,11 +356,7 @@ find_boot_interfaces
 # 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
@@ -374,11 +370,7 @@ case "$1" in
        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)
@@ -394,18 +386,11 @@ case "$1" in
        ;;
 
   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
        ;;
index 342dcdc673232f27a37686983e183b77c43ed1f8..6c7e4117d91f55937313fd5e00197963dc7559ec 100755 (executable)
 # 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
diff --git a/rc.d/rc b/rc.d/rc
index 04d6f383747528a4120f227cc023abef6e92b368..4bf8cb2ad1b84e5044d399c907426639b43d2435 100755 (executable)
--- a/rc.d/rc
+++ b/rc.d/rc
@@ -68,7 +68,7 @@ fi
 # 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
@@ -82,7 +82,7 @@ fi
 
 # 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"
@@ -129,14 +129,6 @@ else
        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
 
index d86f962e8d6d94039069a8404a06656c26d1eb90..96d78646403b283aa9b9eebad6877a12ff5e673e 100755 (executable)
@@ -54,93 +54,89 @@ fi
 # 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
index b01b9d38f863d7cfaecda6ca73faad4a79430f1a..b6bfb29827db80c7d8a9951c8de9964161673f3f 100755 (executable)
@@ -197,17 +197,6 @@ enable_swap() {
        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
@@ -365,7 +354,7 @@ else
        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
 
@@ -437,7 +426,7 @@ else
        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
@@ -629,7 +618,7 @@ if [ -n "$IN_INITLOG" ]; then
        IN_INITLOG=""
 fi
 
-if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
+if [[ "$container" != lxc* ]]; then
        # Clear mtab
        > /etc/mtab
        [ -f /etc/cryptomtab ] && > /etc/cryptomtab
@@ -930,7 +919,6 @@ else
                killall -IO blogd
        fi
 
-       clean_vserver_mtab
 fi
 
 is_yes "$SELINUX" && [ -f /.autorelabel ] && relabel_selinux
@@ -989,37 +977,35 @@ is_yes "$SELINUX" && restorecon /tmp/.ICE-unix >/dev/null 2>&1
 
 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
@@ -1031,8 +1017,8 @@ if ! is_no "$RC_PROMPT"; then
 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
index a4f125d8235fe8973c33af292aa92122e79e834e..096747a8bc5692f41cf75017744de38002d3517e 100644 (file)
@@ -113,12 +113,6 @@ RC_PROMPT=yes
 # 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