about summary refs log tree commit diff
path: root/scripts/nix-copy-closure.in
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2012-03-29T16·20+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-04-13T12·29+0200
commit055e803851e73bb94d341c3b4f25f52be167fef7 (patch)
tree00912107a6f74b6f3f0c8effef6754708768c974 /scripts/nix-copy-closure.in
parent00c98a6befb70228c7ba2b7d5dc8684289915baa (diff)
Add the '--show-progress' flag to nix-copy-closure
Diffstat (limited to 'scripts/nix-copy-closure.in')
-rwxr-xr-xscripts/nix-copy-closure.in10
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/nix-copy-closure.in b/scripts/nix-copy-closure.in
index 1ed24d285208..a38a31a8b5fc 100755
--- a/scripts/nix-copy-closure.in
+++ b/scripts/nix-copy-closure.in
@@ -23,6 +23,8 @@ my $sign = 0;
 my $compressor = "";
 my $decompressor = "";
 
+my $progressViewer = "";
+
 my $toMode = 1;
 
 my $includeOutputs = 0;
@@ -60,6 +62,9 @@ while (@ARGV) {
     elsif ($arg eq "--include-outputs") {
         $includeOutputs = 1;
     }
+    elsif ($arg eq "--show-progress") {
+        $progressViewer = "pv";
+    }
     elsif ($arg eq "--dry-run") {
         $dryRun = 1;
     }
@@ -76,7 +81,7 @@ openSSHConnection $sshHost or die "$0: unable to start SSH\n";
 
 
 if ($toMode) { # Copy TO the remote machine.
-    Nix::CopyClosure::copyTo($sshHost, [ @sshOpts ], [ @storePaths ], $compressor, $decompressor, $includeOutputs, $dryRun, $sign);
+    Nix::CopyClosure::copyTo($sshHost, [ @sshOpts ], [ @storePaths ], $compressor, $decompressor, $includeOutputs, $dryRun, $sign, $progressViewer);
 }
 
 else { # Copy FROM the remote machine.
@@ -101,9 +106,10 @@ else { # Copy FROM the remote machine.
         print STDERR "copying ", scalar @missing, " missing paths from ‘$sshHost’...\n";
         $compressor = "| $compressor" if $compressor ne "";
         $decompressor = "$decompressor |" if $decompressor ne "";
+	$progressViewer = "$progressViewer |" if $progressViewer ne "";
         unless ($dryRun) {
             my $extraOpts = $sign ? "--sign" : "";
-            system("set -f; ssh $sshHost @sshOpts 'nix-store --export $extraOpts @missing $compressor' | $decompressor $Nix::Config::binDir/nix-store --import > /dev/null") == 0
+            system("set -f; ssh $sshHost @sshOpts 'nix-store --export $extraOpts @missing $compressor' | $decompressor $progressViewer $Nix::Config::binDir/nix-store --import > /dev/null") == 0
                 or die "copying store paths from remote machine `$sshHost' failed: $?";
         }
     }