diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-02-21T15·45+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-02-21T15·45+0000 |
commit | 43c4d18c6a4e1a8b129114439718e26c12b49ca8 (patch) | |
tree | 9e8927fbb240928c5d2f2a9fcee0f366d5630058 /src/nix-store/nix-store.cc | |
parent | 46e0919ced4646004cc0701b188d0a68e24e8924 (diff) |
* `nix-store --import': import an archive created by `nix-store
--export' into the Nix store, and optionally check the cryptographic signatures against /nix/etc/nix/signing-key.pub. (TODO: verify against a set of public keys.)
Diffstat (limited to 'src/nix-store/nix-store.cc')
-rw-r--r-- | src/nix-store/nix-store.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index 7b56de7e4d64..61ae4cf4f925 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -651,6 +651,16 @@ static void opExport(Strings opFlags, Strings opArgs) } +static void opImport(Strings opFlags, Strings opArgs) +{ + if (!opFlags.empty()) throw UsageError("unknown flag"); + if (!opArgs.empty()) throw UsageError("no arguments expected"); + + FdSource source(STDIN_FILENO); + cout << format("%1%\n") % store->importPath(false, source); +} + + /* Initialise the Nix databases. */ static void opInit(Strings opFlags, Strings opArgs) { @@ -722,6 +732,8 @@ void run(Strings args) op = opRestore; else if (arg == "--export") op = opExport; + else if (arg == "--import") + op = opImport; else if (arg == "--init") op = opInit; else if (arg == "--verify") |