Recompressing GZIPs for Slax

written by Tomas M. 6 years ago

Does this seem like dejavu? :) Not at all, I was already talking about the very similar recompressing of ZIP archives. As a reminder, Slax is compressed by LZMA2 (XZ in squashfs), so uncompressed data is compressed better than already compressed ZIPs. This is the same for gzip, but gnu gzip refuses -0 (level zero) parameter so it basically just can't produce uncompressed output.

So I had to write own software to actually compress using level=0. It was not any hard at all, since I used PHP :) Here is the short PHP script:

#!/usr/bin/php
<?php
    $data=file_get_contents("php://stdin");
    echo gzencode($data,0);
?>

It reads data from standard input and writes zero-compressed data on standard output. Actually there are not much gzipped files in Slax, few keyboard mappings and some svgz images, to name a few. Recompressing them using zero compression (and packing later using squashfs) makes entire Slax smaller by about 1MB. Not much, but as always, every byte counts :)

Tomas M.

(c) 2019, Tomas M; rss