Recompressing ZIPs for Slax

written by Tomas M. 6 years ago

Some software (for example FireFox) is installed partially compressed. That means some of the data is permanently packed in ZIP archive, and the application (for example firefox) knows how to unzip it on the fly. That is generally a good idea, but for Slax it's not much useful, since squashing zipped data provides poor compression ratio.

Fortunately there is a way how to make it compress better. Since the application which reads the zipped data understands the ZIP format in general, it is possible to extract all the ZIP archives, and compress them again using -0 parameter (meaning the files are just stored in the archive, but not compressed at all).

Lets take firefox again as an example. It has a file omni.ja, which is 7.4MB in size. Don't be fooled by the filename extension .ja ... in fact, it is .zip. If this file omni.ja is compressed by mksquashfs, we get 7.2MB filesystem. That's an improvement, but not any significant. So we extract all the files from the archive (remember, omni.ja), and we compress it again to another ZIP, omni.zip, using parameters -0 -r, so the data is not compressed at all. Finally we rename omni.zip to omni.ja overwriting the original archive. The result is 23MB big instead of 7.4MB, and firefox can read it just fine.

So, 23MB instead of 7.4, that is worse, is it? Well not actually. If such 23MB archive is compressed into Slax bundle, mksquashfs makes a 5.5MB filesystem.

So instead of 7.2MB of data, our results is 24% smaller, only 5.5MB. And THAT is the improvement I'm talking about :) There are not much zipped files in Slax though, yet it's still worth to implement the idea into build scripts.

Tomas M.

(c) 2019, Tomas M; rss