about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2007-02-22T16·42+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2007-02-22T16·42+0000
commitfa2be32034dcb25f9382dda91514a7785211f443 (patch)
tree90d743c0c62efb83dcf41622c0cb11051be85e60
parent4c5e6d1a2f48a26c22ee5b515f8ac672d3d2e7ab (diff)
* nix-copy-closure: force a login shell on the remote machine to make
  sure that nix-store is in the PATH.
* nix-copy-closure: option --gzip to compress data.

-rw-r--r--scripts/nix-copy-closure.in14
1 files changed, 11 insertions, 3 deletions
diff --git a/scripts/nix-copy-closure.in b/scripts/nix-copy-closure.in
index 80a6a80518b5..13b9694656fd 100644
--- a/scripts/nix-copy-closure.in
+++ b/scripts/nix-copy-closure.in
@@ -15,10 +15,13 @@ EOF
 
 # Get the target host.
 my $sshHost = shift @ARGV;
-my @sshOpts = split ' ', $ENV{"NIX_SSHOPTS"};
+my @sshOpts = split ' ', ($ENV{"NIX_SSHOPTS"} or "");
 
 my $sign = 0;
 
+my $compressor = "cat";
+my $decompressor = "cat";
+
 
 # !!! Copied from nix-pack-closure, should put this in a module.
 my %storePathsSeen;
@@ -30,6 +33,11 @@ while (@ARGV) {
         $sign = 1;
         next;
     }
+    if ($storePath eq "--gzip") {
+        $compressor = "gzip";
+        $decompressor = "gunzip";
+        next;
+    }
 
     # $storePath might be a symlink to the store, so resolve it.
     $storePath = (`$binDir/nix-store --query --resolve '$storePath'`
@@ -54,7 +62,7 @@ while (@ARGV) {
 
 
 # Ask the remote host which paths are invalid.
-open(READ, "-|", "ssh", @sshOpts, $sshHost, "nix-store", "--check-validity", "--print-invalid", @storePaths);
+open(READ, "ssh @sshOpts $sshHost sh --login -c '\"nix-store --check-validity --print-invalid @storePaths\"'|");
 my @missing = ();
 while (<READ>) {
     chomp;
@@ -68,6 +76,6 @@ close READ or die;
 if (scalar @missing > 0) {
     my $extraOpts = "";
     $extraOpts .= "--sign" if $sign == 1;
-    system("nix-store --export $extraOpts @missing | ssh @sshOpts $sshHost nix-store --import") == 0
+    system("nix-store --export $extraOpts @missing | $compressor | ssh @sshOpts $sshHost sh --login -c '\"$decompressor | nix-store --import\"'") == 0
         or die "copying store paths to remote machine failed: $?";
 }