fix openrc startup; only fix inittab in plain initstyle
authorBenedikt Boehm <hollow@gentoo.org>
Tue, 11 Mar 2008 10:07:26 +0000 (10:07 +0000)
committerBenedikt Boehm <hollow@gentoo.org>
Tue, 11 Mar 2008 10:07:26 +0000 (10:07 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2702 94cd875c-1c1d-0410-91d2-eb244daf1a30

distrib/gentoo/initpost
scripts/vserver.functions

index ee6e692..a61ab1b 100755 (executable)
@@ -83,17 +83,22 @@ if test "$initstyle" == "gentoo"; then
        echo "!!! Consult the Gentoo Handbook on how to chroot and install"
        echo "!!! packages into the guest environment."
        echo "!!!"
+else
+       # fix gettys in inittab
+       if $_CHROOT_SH testfile /etc/inittab; then
+               echo ">>> Fixing inittab ... "
+               chrootsed /etc/inittab \
+                       -e 's/\(^[^#].*getty.*$\)/#\1/'
+       fi
 fi
 
-
 # unneeded runlevel scripts
-echo ">>> Fixing default runlevel scripts ... "
 if test $have_openrc -ne 1; then
+       echo ">>> Fixing default runlevel scripts ... "
        $_CHROOT_SH rm /etc/runlevels/boot/{clock,consolefont,keymaps,modules,net.lo} 2>/dev/null || :
        $_CHROOT_SH rm /etc/runlevels/default/{hdparm,netmount} 2>/dev/null || :
 fi
 
-
 # setting hostname
 if test -r "$cfgdir"/uts/nodename && $_CHROOT_SH testfile /etc/conf.d/hostname; then
        echo ">>> Setting hostname ... "
@@ -101,7 +106,6 @@ if test -r "$cfgdir"/uts/nodename && $_CHROOT_SH testfile /etc/conf.d/hostname;
                -e "s:\(HOSTNAME\)=\"\(.*\)\":\1=\"$(< "$cfgdir"/uts/nodename)\":i"
 fi
 
-
 # fix syslog-ng.conf
 if $_CHROOT_SH testfile /etc/syslog-ng/syslog-ng.conf; then
        echo ">>> Fixing syslog-ng.conf ... "
@@ -110,15 +114,6 @@ if $_CHROOT_SH testfile /etc/syslog-ng/syslog-ng.conf; then
                -e 's:\(.*console_all.*\):#\1:g'
 fi
 
-
-# fix gettys in inittab
-if $_CHROOT_SH testfile /etc/inittab; then
-       echo ">>> Fixing inittab ... "
-       chrootsed /etc/inittab \
-               -e 's/\(^[^#].*getty.*$\)/#\1/'
-fi
-
-
 # fix fstab for checkfs/localmount in baselayout-2
 # (does not affect any previous versions)
 if test $have_openrc -ne 1; then
index 472673a..c97c0c6 100644 (file)
@@ -317,7 +317,15 @@ function _generateInitOptions
            test -n "$RUNLEVEL_START" || RUNLEVEL_START="default"
            RC_PATH=/usr/sbin:/usr/bin:/sbin:/bin
 
-           INITCMD_START=( env TERM=$TERM /lib/rcscripts/sh/init-vserver.sh "$RUNLEVEL_START" )
+           if test -x "$vdir/vdir/lib/rcscripts/sh/init-vserver.sh"; then
+               RC_WRAP=/lib/rcscripts/sh/init-vserver.sh
+           elif test -x "$vdir/vdir/lib/rc/sh/init-vserver.sh"; then
+               RC_WRAP=/lib/rc/sh/init-vserver.sh
+           else
+               panic "init-vserver.sh not found; aborting"
+           fi
+
+           INITCMD_START=( env TERM=$TERM $RC_WRAP "$RUNLEVEL_START" )
            INITCMD_STOP=( env -i PATH=$RC_PATH TERM=$TERM RUNLEVEL=0 /sbin/rc shutdown )
            INITCMD_PREPARE=( $_FAKE_RUNLEVEL 3 /var/run/utmp )
            ;;