* Absolutize the path to the VM start script.

svn path=/nixos/trunk/; revision=25154
This commit is contained in:
Eelco Dolstra 2010-12-16 13:53:17 +00:00
parent aaf3247e80
commit 8496dbf350

View File

@ -24,6 +24,13 @@ sub new {
my ($class, $args) = @_; my ($class, $args) = @_;
my $startCommand = $args->{startCommand}; my $startCommand = $args->{startCommand};
my $name = $args->{name};
if (!$name) {
$startCommand =~ /run-(.*)-vm$/;
$name = $1 || "machine";
}
if (!$startCommand) { if (!$startCommand) {
# !!! merge with qemu-vm.nix. # !!! merge with qemu-vm.nix.
$startCommand = $startCommand =
@ -34,12 +41,8 @@ sub new {
$startCommand .= "-cdrom $args->{cdrom} " $startCommand .= "-cdrom $args->{cdrom} "
if defined $args->{cdrom}; if defined $args->{cdrom};
$startCommand .= $args->{qemuFlags} || ""; $startCommand .= $args->{qemuFlags} || "";
} } else {
$startCommand = Cwd::abs_path $startCommand;
my $name = $args->{name};
if (!$name) {
$startCommand =~ /run-(.*)-vm$/;
$name = $1 || "machine";
} }
my $tmpDir = $ENV{'TMPDIR'} || "/tmp"; my $tmpDir = $ENV{'TMPDIR'} || "/tmp";
@ -126,7 +129,7 @@ sub start {
$ENV{QEMU_KERNEL_PARAMS} = "hostTmpDir=$ENV{TMPDIR}"; $ENV{QEMU_KERNEL_PARAMS} = "hostTmpDir=$ENV{TMPDIR}";
chdir $self->{stateDir} or die; chdir $self->{stateDir} or die;
exec $self->{startCommand}; exec $self->{startCommand};
die; die "running VM script: $!";
} }
# Process serial line output. # Process serial line output.