From b34fcce9f027377571ccfa64cc8317417fd6bded Mon Sep 17 00:00:00 2001 From: Nigel McNie Date: Tue, 3 Apr 2007 16:26:53 +1200 Subject: [PATCH] Moved pre-host execution to before starting the vserver. This allows the pre-host script to do things like configure the files in /etc/vservers/${VSNAME} before the vserver is started. --- vserverctl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vserverctl b/vserverctl index 8c5ddb4..28ad89d 100755 --- a/vserverctl +++ b/vserverctl @@ -83,6 +83,11 @@ if ( $action eq 'add' ) { '-d' => $config->{release}, '-m' => $config->{mirror}, ); + + open $scriptFH, '|-', '/bin/bash'; + print {$scriptFH} $config->{files}{'pre-host'}; + close $scriptFH; + write_file('/etc/vservers/' . $vsname . '/context', getFreeContext() . "\n"); system('vserver', $vsname, 'start'); write_file('/etc/vservers/' . $vsname . '/profile', $profile . "\n"); @@ -90,9 +95,6 @@ if ( $action eq 'add' ) { # TODO: get the apt-key stuff working system('vserver', $vsname, 'apt-get', 'update'); - open $scriptFH, '|-', '/bin/bash'; - print {$scriptFH} $config->{files}{'pre-host'}; - close $scriptFH; open $scriptFH, '|-', 'vserver', $vsname, 'exec', '/bin/bash'; print {$scriptFH} $config->{files}{'pre-vserver'}; close $scriptFH; -- 2.39.5