* Add bzip2 and xz support to nix-copy-closure.

This commit is contained in:
Eelco Dolstra 2011-11-23 15:29:58 +00:00
parent 5bbd693cae
commit d5ac78e0d6
2 changed files with 17 additions and 4 deletions

View file

@ -24,6 +24,8 @@
</group> </group>
<arg><option>--sign</option></arg> <arg><option>--sign</option></arg>
<arg><option>--gzip</option></arg> <arg><option>--gzip</option></arg>
<arg><option>--bzip2</option></arg>
<arg><option>--xz</option></arg>
<arg choice='plain'> <arg choice='plain'>
<arg><replaceable>user@</replaceable></arg><replaceable>machine</replaceable> <arg><replaceable>user@</replaceable></arg><replaceable>machine</replaceable>
</arg> </arg>
@ -96,10 +98,13 @@ those paths. If this bothers you, use
</varlistentry> </varlistentry>
<varlistentry><term><option>--gzip</option></term> <varlistentry><term><option>--gzip</option> / <option>--bzip2</option> / <option>--xz</option></term>
<listitem><para>Compress the dump of each path with <listitem><para>Compress the dump of each path with respectively
<command>gzip</command> before sending it.</para></listitem> <command>gzip</command>, <command>bzip2</command> or
<command>xz</command> before sending it. The corresponding
decompression program must be installed on the target
machine.</para></listitem>
</varlistentry> </varlistentry>

View file

@ -8,7 +8,7 @@ use Nix::CopyClosure;
if (scalar @ARGV < 1) { if (scalar @ARGV < 1) {
print STDERR <<EOF print STDERR <<EOF
Usage: nix-copy-closure [--from | --to] HOSTNAME [--sign] [--gzip] PATHS... Usage: nix-copy-closure [--from | --to] HOSTNAME [--sign] [--gzip] [--bzip2] [--xz] PATHS...
EOF EOF
; ;
exit 1; exit 1;
@ -43,6 +43,14 @@ while (@ARGV) {
$compressor = "gzip"; $compressor = "gzip";
$decompressor = "gunzip"; $decompressor = "gunzip";
} }
elsif ($arg eq "--bzip2") {
$compressor = "bzip2";
$decompressor = "bunzip2";
}
elsif ($arg eq "--xz") {
$compressor = "xz";
$decompressor = "xz -d";
}
elsif ($arg eq "--from") { elsif ($arg eq "--from") {
$toMode = 0; $toMode = 0;
} }