index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
-rwxr-xr-x | lib/common-functions | 20 |
diff --git a/lib/common-functions b/lib/common-functions index d8da4a7..aa78ebd 100755 --- a/lib/common-functions +++ b/lib/common-functions @@ -758,3 +758,23 @@ verbose_flock() { return ${err} } } + +# recompress_gz $tmp_dir $file1.gz $file2.gz ... +# recompress the given file(s) to make them rsync friendly +recompress_gz() { + tmp_file=$( + mktemp "$1/recompress_gz.XXXXXXXX)" + ) + shift + local file + for file in "$@"; do + if [ ! -f "${file}" ]; then + continue + fi + mv "${file}" "${tmp_file}" + zcat "${tmp_file}" | \ + gzip --best --rsyncable > \ + "${file}" + done + rm "${tmp_file}" +} |