From 43c4d18c6a4e1a8b129114439718e26c12b49ca8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 21 Feb 2007 15:45:32 +0000 Subject: * `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.) --- src/nix-store/nix-store.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/nix-store/nix-store.cc') 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") -- cgit 1.4.1