index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2018-06-13 16:22:08 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-06-13 16:22:08 +0200 |
commit | 1433976802baf67c89038d699d0a50522bc138cc (patch) | |
tree | 10c3b0adb34c644fdbeaf20a2a09b925c495987c /lib/common-functions | |
parent | d7d699efe7941f626617e952fb8ecf057f493ec8 (diff) |
-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}" +} |