]> git.mjollnir.org Git - vserverctl.git/commitdiff
Moved pre-host execution to before starting the vserver.
authorNigel McNie <nigel@catalyst.net.nz>
Tue, 3 Apr 2007 04:26:53 +0000 (16:26 +1200)
committerNigel McNie <nigel@freud.wgtn.cat-it.co.nz>
Tue, 3 Apr 2007 04:26:53 +0000 (16:26 +1200)
This allows the pre-host script to do things like configure the files in /etc/vservers/${VSNAME} before the vserver is started.

vserverctl

index 8c5ddb44f974c34b3f658e6b61225f8b4b0dc479..28ad89dc4650f7d3ad6ff53fcfbc662b1d2b2910 100755 (executable)
@@ -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;