is
changeset 36 bdc967bf50d2
parent 35 1c7e99693439
child 37 a61b92c60367
--- a/is	Fri Jan 29 00:35:46 2010 +0100
+++ b/is	Sun Jan 31 01:17:32 2010 +0100
@@ -8,13 +8,17 @@
 use Getopt::Long;
 use Pod::Usage;
 use File::Basename;
+use Data::Dumper;
 
 use lib "lib";
 use SI::system;
+use SI::ptable;
+use SI::lvm;
 
 my $ME = basename $0;
 my $opt_base = "..";
 my $opt_src = undef;
+my $opt_verbose = undef;
 
 
 MAIN: {
@@ -22,19 +26,69 @@
     GetOptions(
 	"base=s" => \$opt_base,
 	"src=s"	=> \$opt_src,
+	"help" => sub { pod2usage(-verbose => 1, exit => 0) },
+	"man" => sub { pod2usage(-verbose => 2, exit => 0) },
+	"verbose" => \$opt_verbose,
     ) or pod2usage;
 		
     my $id = SI::system::id();
 
     # now check if we find a suitable image
-    my $src = defined $opt_src ? $opt_src : "$opt_base/image-$id";
+    my $src = defined $opt_src ? $opt_src : "image-$id";
+    $src = "$opt_base/$src" if $src !~ /\//;
+
     -d $src or die "$ME: $src: $!\n";
 
     our $VAR1;
     do "$src/info/devices";
     my %devices = %$VAR1;
 
-    die %devices;
+#    SI::ptable::restore(%devices);
+#    SI::ptable::mkfs(%devices);
+    SI::lvm::pvcreate(%devices);
+    SI::lvm::vgcfgrestore("$src/lvm/vg.*", %devices);
+
+
+    exit;
+    die Dumper \%devices;
 
 }
+
+__END__
+
+=head1 NAME
+
+is - revert si (recover from system image)
+
+=head1 SYNOPSIS
+
+  is [--base=BASE] [--source=SOURCE]
+  is --help
+  is --man
+
+=head1 DESCRIPTION
+
+This B<is> tool installs the image you saved with B<si>.
+
+=head1 OPTIONS
+
+=over
+
+=item B<-b>|B<--base> I<base>
+
+The directory where to look for the images. Each image should have 
+a unique subdirectory there. (default: I<..>)
+
+=item B<-s>|B<--source> I<source>
+
+The source of the image. If the source does not contain a slash ("/"), the
+it is expected to be a subdirectory of the base (see option B<--base>).
+
+Normally the source directories are named by the MAC address of the system. 
+For convenience a symbolic link with the hostname of the saved systems may be
+in place. (default: mac address)
+
+=back
+
+=cut
 # vim:sts=4 sw=4 aw ai si: