3 ###APPAUTHOR: xiaoranzzz
4 ###APPDATE: Thu Apr 17 03:54:33 2008
7 ###APPUSAGE: (GhostImage) (DiskImages,...)
8 ###APPEXAMPLE: qemu-ghost win2k win2k.gho
11 #ENV variable MUST be defined somewhere,
12 #FOR perl to search modules from,
14 use lib
$ENV{XR_PERL_MODULE_DIR
};
15 use MyPlace
::Script
::Usage qw
/help_required help_even_empty/;
16 exit 0 if(help_even_empty
($0,@ARGV));
21 die("File not exists:$ghostimg\n") unless(-f
$ghostimg);
22 foreach my $diskimg (@ARGV) {
23 die("File not exists:$diskimg\n") unless(-f
$diskimg);
26 my $ghostd="/tmp/qemu-ghost.xiaoranzzz";
28 mkdir $ghostd or die("$!\n");
31 if($ghostimg !~ /^\//) {
32 $ghostimg =~ s/\.\///;
33 $ghostimg = $ENV{PWD
} . "/$ghostimg";
35 my $lname=$ghostd . "/ghost.gho";
37 print STDERR
"Link \"$ghostimg\" to \"$lname\"\n";
38 system("ln","-sf",$ghostimg,$lname);
40 my $hda="/myplace/emuos/ghostbox.raw";
41 my $hdb="fat:$ghostd";
43 #print STDERR join(" ",("myqemu","-hda",$hda,"-hdb",$hdb,"-hdc",$diskimg)),"\n";
46 push @arg,"-hdc",$ARGV[0] if($ARGV[0]);
47 push @arg,"-hdd",$ARGV[1] if($ARGV[1]);
49 exec "qemudos","-hda",$hda,"-hdb",$hdb,@arg;