From 4b10d4bed6cbd4b32dd65652af601bbf38de146d Mon Sep 17 00:00:00 2001
From: Michael Vrable <mvrable@cs.ucsd.edu>
Date: Fri, 14 Sep 2007 22:04:20 -0700
Subject: [PATCH] Enhance object-checksums command.

If no segments are specified, dump object checksums for all segments.
Additionally, prompt for a password (to decrypt segments) when needed.
---
 lbs-util | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lbs-util b/lbs-util
index 33c9c75..1eac1a0 100755
--- a/lbs-util
+++ b/lbs-util
@@ -68,10 +68,14 @@ def cmd_list_snapshot_sizes():
         previous = set(segments)
         print "%s: %.3f +%.3f -%.3f" % (s, size / 1024.0**2, added / 1024.0**2, removed / 1024.0**2)
 
-# Build checksum list for objects in the given segments
+# Build checksum list for objects in the given segments, or all segments if
+# none are specified.
 def cmd_object_checksums(segments):
+    get_passphrase()
     lowlevel = lbs.LowlevelDataStore(options.store)
     store = lbs.ObjectStore(lowlevel)
+    if len(segments) == 0:
+        segments = sorted(lowlevel.list_segments())
     for s in segments:
         for (o, data) in store.load_segment(s):
             csum = lbs.ChecksumCreator().update(data).compute()
-- 
2.20.1