One of our customers wanted to make it especially easy to handle a zip file download we were generating on the fly for him. On a hunch, I went looking for ways to generate self extracting ZIP files. The big catch being that I needed to be able to create them on the fly on a Linux box.
After a whole lot of poking I found two really useful articles:
- Howto: create a Windows compatible (.exe) self-extracting ZIP file in Ubuntu
- Building a self-extracting Windows installation package under GNU/Linux
Both systems use the same approach: take a small windows executable and append to it the actual zip file, and have Windows folks use that. The Windows executable at the start of the file will run first, no doubt seek to it's end, and then unpack the embedded zip file.
If you ask me, it's pure genius.
The 7-zip approach even gets slightly fancier, and embeds a configuration file between the binary and archive, which says what program to run.
But for my purposes, the self extracting zip file should do the trick.
If nothing else, thinking through the whole appending-your-data-to-the-end-of-the-binary trick has been worth pondering. Come to think of it, perl actually made extensive use of this trick with their __END__ and __DATA__ keywords.