X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=scripts%2Fvserver-build.functions;h=c8ccb84e23a3a9eda0993004b961ad663e197155;hb=b7785f953cf988346d0f36c5852af39db3d1b00c;hp=15c182f4459d67aa7a3dfbe24d1f25cb524c38f2;hpb=b0a62d195efca12c5cb9e7c0b3bea3be2cd57fc9;p=util-vserver.git diff --git a/scripts/vserver-build.functions b/scripts/vserver-build.functions index 15c182f..c8ccb84 100644 --- a/scripts/vserver-build.functions +++ b/scripts/vserver-build.functions @@ -1,4 +1,4 @@ -# $Id: vserver-build.functions 2515 2007-03-18 15:32:22Z dhozac $ --*- sh -*-- +# $Id: vserver-build.functions 2704 2008-03-16 03:30:22Z dhozac $ --*- sh -*-- # Copyright (C) 2003 Enrico Scholz # @@ -54,7 +54,8 @@ function populateDev { local spec - mkdir -p -m755 "$VDIR"/dev/pts + mkdir -p -m755 "$VDIR"/dev + mkdir -m755 "$VDIR"/dev/pts while read spec; do makeDevEntry "$VDIR"/dev $spec @@ -183,6 +184,8 @@ ERROR: Can not determine distribution; please specify it manually with ERROR: Can not find configuration for the distribution '$DISTRIBUTION'; please read http://linux-vserver.org/HowToRegisterNewDistributions for information how to add support for your own distribution." + + export DISTRIBUTION } function base._addGeneratedFile @@ -200,6 +203,9 @@ exist already; please try to use '--force', or remove them manually." mkdir -p -m755 "$VDIR" $_SETATTR --~barrier "$VDIR" + $_SETATTR --barrier "$VDIR"/.. || colwarn $"\ +WARNING: could not set the barrier attribute on '$VDIR/..', + please set it manually." base._addGeneratedFile "$VDIR" mkdir -p -m755 "$SETUP_CONFDIR"/apps "$VDIR"/etc @@ -254,3 +260,27 @@ function base.setSuccess { __BASE_SUCCESS=1 } + +function startSleepingGuest +{ + local guest="$1" + local timeout="${2:-15}" + $_VSERVER "$guest" start --rescue --rescue-init bash -c " + exec > /dev/null + exec 2> /dev/null + trap 'kill -s 9 -- -1; exit 0' INT + i=0 + while [ \$i -lt $timeout ]; do + sleep 1 + let ++i + done + kill -s 15 -- -1 + sleep 1 + kill -s 9 -- -1" +} + +function stopSleepingGuest +{ + local guest="$1" + $_VSERVER "$guest" stop --rescue-init +}