about summary refs log tree commit diff
path: root/src/nix-store/main.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-02-08T13·48+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-02-08T13·48+0000
commitc5474398433225e40c8868b0952aebe36da2c849 (patch)
tree6cb7fbf87fea619368637ad72a33fb7765c6a14a /src/nix-store/main.cc
parent3d74274b37a0f3b841ad860143f9c17401c3d7c4 (diff)
* Subflag in `--verify': `nix-store --verify --check-contents' checks
  that the contents of store paths has not changed by comparing hashes
  of their current contents to the hashes stored in the database.

Diffstat (limited to 'src/nix-store/main.cc')
-rw-r--r--src/nix-store/main.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/nix-store/main.cc b/src/nix-store/main.cc
index a3c1b8fa782e..a124543fb230 100644
--- a/src/nix-store/main.cc
+++ b/src/nix-store/main.cc
@@ -420,7 +420,17 @@ static void opInit(Strings opFlags, Strings opArgs)
 /* Verify the consistency of the Nix environment. */
 static void opVerify(Strings opFlags, Strings opArgs)
 {
-    verifyStore();
+    if (!opArgs.empty())
+        throw UsageError("no arguments expected");
+
+    bool checkContents = false;
+    
+    for (Strings::iterator i = opFlags.begin();
+         i != opFlags.end(); ++i)
+        if (*i == "--check-contents") checkContents = true;
+        else throw UsageError(format("unknown flag `%1%'") % *i);
+    
+    verifyStore(checkContents);
 }