--- a/si Tue Jan 19 23:45:54 2010 +0100
+++ b/si Tue Jan 19 23:48:10 2010 +0100
@@ -22,24 +22,25 @@
use SI::system;
my $opt_exit = "";
-my $opt_dir = "";
+my $opt_dir = "";
MAIN: {
- GetOptions("exit=s" => \$opt_exit,
- "dir=s" => \$opt_dir)
- or die "Bad usage\n";
+ GetOptions(
+ "exit=s" => \$opt_exit,
+ "dir=s" => \$opt_dir
+ ) or die "Bad usage\n";
- my %devices; # the overall data collector
+ my %devices; # the overall data collector
my $dir;
-
+
if ($opt_dir ne "") {
- $dir = $opt_dir;
- }
+ $dir = $opt_dir;
+ }
else {
- $dir = dirname($0) . "/../image-" . SI::system::id();
- remove_tree($dir);
- -d $dir or mkdir($dir, 0700) or die "Can't mkdir $dir: $!\n";
+ $dir = dirname($0) . "/../image-" . SI::system::id();
+ remove_tree($dir);
+ -d $dir or mkdir($dir, 0700) or die "Can't mkdir $dir: $!\n";
}
make_path(map { "$dir/$_" } qw(ptable lvm blkid mbr dump));
@@ -61,7 +62,7 @@
SI::dumper::dump("$dir/dump/%s", %devices);
my $o = new IO::File ">$dir/devices"
- or die "ERR: Can't open $dir/devices: $!\n";
+ or die "ERR: Can't open $dir/devices: $!\n";
$o->print(Dumper \%devices);
# we wait until now, since now it's sure that
@@ -70,9 +71,8 @@
my $hostname = SI::system::hostname(%devices);
symlink(basename($dir), "../image-$hostname");
-
exit;
- }
+}
# vim:sts=4 sw=4 aw ai si: