aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2007-02-22 15:48:20 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2007-02-22 15:48:20 +0000
commit4c5e6d1a2f48a26c22ee5b515f8ac672d3d2e7ab (patch)
tree3926b45d2b67974ae7ba2c0c47265221d02861ee
parent024a8ed3822867c5f9b9498bd8b27fa5dc180846 (diff)
* nix-copy-closure: option --sign.
* nix-copy-closure: set SSH options through NIX_SSHOPTS..
-rw-r--r--scripts/nix-copy-closure.in22
1 files changed, 20 insertions, 2 deletions
diff --git a/scripts/nix-copy-closure.in b/scripts/nix-copy-closure.in
index ec2df8828..80a6a8051 100644
--- a/scripts/nix-copy-closure.in
+++ b/scripts/nix-copy-closure.in
@@ -4,8 +4,20 @@ my $binDir = $ENV{"NIX_BIN_DIR"};
$binDir = "@bindir@" unless defined $binDir;
+if (scalar @ARGV < 1) {
+ print STDERR <<EOF
+Usage: nix-copy-closure HOSTNAME [--sign] PATHS...
+EOF
+ ;
+ exit 1;
+}
+
+
# Get the target host.
my $sshHost = shift @ARGV;
+my @sshOpts = split ' ', $ENV{"NIX_SSHOPTS"};
+
+my $sign = 0;
# !!! Copied from nix-pack-closure, should put this in a module.
@@ -14,6 +26,10 @@ my @storePaths = ();
while (@ARGV) {
my $storePath = shift @ARGV;
+ if ($storePath eq "--sign") {
+ $sign = 1;
+ next;
+ }
# $storePath might be a symlink to the store, so resolve it.
$storePath = (`$binDir/nix-store --query --resolve '$storePath'`
@@ -38,7 +54,7 @@ while (@ARGV) {
# Ask the remote host which paths are invalid.
-open(READ, "-|", "ssh", $sshHost, "nix-store", "--check-validity", "--print-invalid", @storePaths);
+open(READ, "-|", "ssh", @sshOpts, $sshHost, "nix-store", "--check-validity", "--print-invalid", @storePaths);
my @missing = ();
while (<READ>) {
chomp;
@@ -50,6 +66,8 @@ close READ or die;
# Export the store paths and import them on the remote machine.
if (scalar @missing > 0) {
- system("nix-store --export @missing | ssh $sshHost nix-store --import") == 0
+ my $extraOpts = "";
+ $extraOpts .= "--sign" if $sign == 1;
+ system("nix-store --export $extraOpts @missing | ssh @sshOpts $sshHost nix-store --import") == 0
or die "copying store paths to remote machine failed: $?";
}