source: trunk/vmctl/vmctl @ 567

Last change on this file since 567 was 567, checked in by price, 16 years ago

note vmctl as license exception

  • Property svn:executable set to *
File size: 854 bytes
Line 
1#!/usr/bin/env perl
2# NOTICE
3# Unlike everything else in this repository, this file does not come with
4# any particular license, as the author (zev) stopped being involved before we
5# got down to putting a license on the project.
6use warnings;
7use strict;
8
9my $subcmd = shift;
10
11my %cmds = ("install" => \&install);
12
13
14if (exists $cmds{$subcmd}) {
15  $cmds{$subcmd}->();
16} else {
17  print "No such subcommand: '$subcmd'\n";
18}
19
20sub install {
21  my ($installer, $host_device) = @ARGV;
22  $host_device =~ s#^/dev/##;
23  my $installer_hostname = "magic";
24  my $guest_dev = $host_device;
25  $guest_dev =~ tr#/#_#;
26
27  run("xm", "block-attach", $installer, "phys:$host_device", "$guest_dev", "rw");
28  run("remctl", $installer_hostname, "installer", "install", $guest_dev);
29  run("xm", "block-detach", $installer, $guest_dev, "rw");
30}
31
32sub run {
33  system("echo", @_);
34}
Note: See TracBrowser for help on using the repository browser.