* Remove the `cat' calls when not using --gzip.

This commit is contained in:
Eelco Dolstra 2010-02-04 01:39:23 +00:00
parent 408913bbaf
commit e51a276907
1 changed files with 7 additions and 7 deletions

View File

@ -19,8 +19,8 @@ my $sshHost;
my $sign = 0; my $sign = 0;
my $compressor = "cat"; my $compressor = "";
my $decompressor = "cat"; my $decompressor = "";
my $toMode = 1; my $toMode = 1;
@ -35,8 +35,8 @@ while (@ARGV) {
$sign = 1; $sign = 1;
} }
elsif ($arg eq "--gzip") { elsif ($arg eq "--gzip") {
$compressor = "gzip"; $compressor = "| gzip";
$decompressor = "gunzip"; $decompressor = "gunzip |";
} }
elsif ($arg eq "--from") { elsif ($arg eq "--from") {
$toMode = 0; $toMode = 0;
@ -73,7 +73,7 @@ if ($toMode) { # Copy TO the remote machine.
# Ask the remote host which paths are invalid. # Ask the remote host which paths are invalid.
open(READ, "ssh @sshOpts $sshHost nix-store --check-validity --print-invalid @allStorePaths|"); open(READ, "ssh $sshHost @sshOpts nix-store --check-validity --print-invalid @allStorePaths|");
my @missing = (); my @missing = ();
while (<READ>) { while (<READ>) {
chomp; chomp;
@ -88,7 +88,7 @@ if ($toMode) { # Copy TO the remote machine.
print STDERR " $_\n" foreach @missing; print STDERR " $_\n" foreach @missing;
my $extraOpts = ""; my $extraOpts = "";
$extraOpts .= "--sign" if $sign == 1; $extraOpts .= "--sign" if $sign == 1;
system("nix-store --export $extraOpts @missing | $compressor | ssh @sshOpts $sshHost '$decompressor | nix-store --import'") == 0 system("nix-store --export $extraOpts @missing $compressor | ssh $sshHost @sshOpts '$decompressor nix-store --import'") == 0
or die "copying store paths to remote machine `$sshHost' failed: $?"; or die "copying store paths to remote machine `$sshHost' failed: $?";
} }
@ -130,7 +130,7 @@ else { # Copy FROM the remote machine.
print STDERR " $_\n" foreach @missing; print STDERR " $_\n" foreach @missing;
my $extraOpts = ""; my $extraOpts = "";
$extraOpts .= "--sign" if $sign == 1; $extraOpts .= "--sign" if $sign == 1;
system("ssh @sshOpts $sshHost 'nix-store --export $extraOpts @missing | $compressor' | $decompressor | @bindir@/nix-store --import") == 0 system("ssh $sshHost @sshOpts 'nix-store --export $extraOpts @missing $compressor' | $decompressor @bindir@/nix-store --import") == 0
or die "copying store paths from remote machine `$sshHost' failed: $?"; or die "copying store paths from remote machine `$sshHost' failed: $?";
} }