--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/is Mon Feb 01 00:07:30 2010 +0100
@@ -0,0 +1,99 @@
+#! /usr/bin/perl
+# system imager - proof of concept
+# (c) 2010 Heiko Schlittermann <hs@schlittermann.de>
+# see http://keller.schlittermann.de/hg/ius/si
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use File::Basename;
+use Data::Dumper;
+
+use lib "lib";
+use SI::system;
+use SI::ptable;
+use SI::lvm;
+use SI::dumper;
+use SI::grub;
+
+my $ME = basename $0;
+my $opt_base = "..";
+my $opt_src = undef;
+my $opt_verbose = undef;
+
+
+MAIN: {
+
+ 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 : "image-$id";
+ $src = "$opt_base/$src" if $src !~ /\//;
+
+ -d $src or die "$ME: $src: $!\n";
+
+ our $VAR1;
+ do "$src/info/devices";
+ my %devices = %$VAR1;
+
+ #SI::ptable::restore(%devices);
+ #SI::ptable::mkfs(%devices);
+ #SI::lvm::pvcreate(%devices);
+ #SI::lvm::vgcfgrestore("$src/lvm/vg.*", %devices);
+ #SI::lvm::mkfs(%devices);
+ #SI::dumper::restore("$src/dump/*", %devices);
+ SI::grub::restore(%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: