X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;ds=sidebyside;f=lbs-util;fp=lbs-util;h=0000000000000000000000000000000000000000;hb=739b69dd40db62b2502ff7d56e54e43d698fc3d5;hp=5a5ebf68a8f7e2c733893a3f2902c603709fc2c9;hpb=f48d9bc505b99bf3e83ae15f5c46c5a7b2d188b7;p=cumulus.git diff --git a/lbs-util b/lbs-util deleted file mode 100755 index 5a5ebf6..0000000 --- a/lbs-util +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/perl -w -# -# lbs-util: Tool for managing LBS archives. -# -# Usage: lbs-util -# -# Available commands: -# --list-snapshots -# --list-segments -# --verify-snapshot - -use strict; -use LBS qw(parse_headers); -use Term::ReadPassword; - -sub get_password { - return if exists $ENV{LBS_GPG_PASSPHRASE}; - $ENV{LBS_GPG_PASSPHRASE} = read_password('Passphrase: '); -} - -die "Too few arguments!\n" unless scalar(@ARGV) >= 2; -die "Must specify a repository!\n" unless -d $ARGV[0]; - -my $store = new LBS::Store $ARGV[0]; -my $cmd = $ARGV[1]; -my @args = @ARGV[2 .. $#ARGV]; - -if ($cmd eq "--list-snapshots") { - foreach ($store->list_snapshots()) { - print $_, "\n"; - } -} elsif ($cmd eq "--list-segments") { - foreach ($store->list_segments()) { - print $_, "\n"; - } -} elsif ($cmd eq "--verify-snapshot") { - get_password(); - - my $snapshot = $store->load_snapshot($args[0]); - my %info = parse_headers($snapshot); - print "Root: $info{Root}\n"; - - my $metadata = new LBS::MetadataParser $store, $info{Root}; - while ((my %item = $metadata->get_item())) { - print $item{name}, "\n"; - if ($item{type} eq '-') { - my $size = 0; - my $verifier = new LBS::ChecksumVerifier $item{checksum}; - foreach (split /\s+/, $item{data}) { - my $data = $store->load_ref($_); - $verifier->add($data); - $size += length($data); - } - if (!$verifier->verify() || $size != $item{size}) { - fprintf STDERR "Verification failure for $item{name}\n"; - } - } - } -} else { - die "Unknown command: $cmd\n"; -}