X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fdistrib%2Fredhat%2Finitpost;h=d4c6a38d8e69d36a1a21d6fc7238defd2b52d1dc;hb=faa778968d1a7dfeaebc9fe4b847e691dc62fd15;hp=b9ae64d1b6463e50554d93c8ccdb7bf7d25e1c84;hpb=74f554b04afbd8ac6e1f5c8cdb89fd77a0854660;p=util-vserver.git diff --git a/util-vserver/distrib/redhat/initpost b/util-vserver/distrib/redhat/initpost index b9ae64d..d4c6a38 100755 --- a/util-vserver/distrib/redhat/initpost +++ b/util-vserver/distrib/redhat/initpost @@ -33,13 +33,31 @@ function subst case "$1" in (/*|./*) cat "$1";; - (*) $_CHROOT_CAT -i "$1";; + (*) $_CHROOT_SH cat "$1";; esac | sed -e "$2" >$tmp - cmp -s $tmp "$1" || $_CHROOT_CAT -o "$1" <$tmp + cmp -s $tmp "$1" || $_CHROOT_SH truncate "$1" <$tmp rm -f $tmp } +vserver=$1 + +## Do some magic to set the vserver into a defined state +$_VSERVER "$vserver" stop &>/dev/null || : +$_VSERVER "$vserver" start --rescue bash -c ' + exec >/dev/null + exec 2>/dev/null + + set -x + f=/tmp/startwait + trap "rm -f $f" EXIT + mkfifo $f + ( sleep 10; kill -s 9 -- -1 ) & + cat "$f" >/dev/null + kill -s 9 -- -1 + wait +' + pushd "$vdir"/etc/init.d &>/dev/null || pushd "$vdir"/etc/rc.d/init.d &>/dev/null || exit 1 @@ -49,12 +67,11 @@ pushd "$vdir"/etc/init.d &>/dev/null || functions|halt|killall|single) ;; syslog) ;; *) - $_VSERVER ----insecure "$1" chkconfig "$i" off + $_VSERVER "$1" chkconfig "$i" off ;; esac done - relink /bin/true halt popd >/dev/null pushd "$vdir"/sbin &>/dev/null @@ -66,15 +83,26 @@ pushd "$vdir"/usr/bin &>/dev/null popd >/dev/null pushd "$vdir" &>/dev/null - echo 'NETWORKING=yes' | $_CHROOT_CAT -a /etc/sysconfig/network + echo 'NETWORKING=yes' | $_CHROOT_SH append /etc/sysconfig/network popd >/dev/null pushd "$vdir" &>/dev/null - : | $_CHROOT_CAT -o /etc/sysctl.conf - echo "none / none defaults" | $_CHROOT_CAT -o /etc/fstab - cat "$__DISTRIBDIR"/redhat/rc.sysinit | $_CHROOT_CAT -o /etc/rc.d/rc.sysinit.vserver + cat </dev/null + +$_VSERVER "$vserver" exec bash -c ': >/tmp/startwait' &>/dev/null || : +$_VSERVER "$vserver" stop &>/dev/null || :