A long while ago, I made up a distribution for a Tk program I was writing that had graphic files, modules, configuration files, documentation and all kinds of crap and it worked under a variety of Unix platforms. For the life of me, I can't find this code! Ugh!
What I do remember is the thought processes behind it, and I'll outline here:
- It started as a perl script (.pl) with a huge __DATA__ section and it had to be FTP'd as /binary/ or it wouldn't work.
- The data section was made by having sections marked off with a filename and an extent. "foo.pm234151 bar.pm123124 junk.gif1234" and so on. Following that was the raw data for each file.
- The data I had packed with simple run-length encoding (lots of gifs with lots of blank areas). A better solution would have been to use something like mjd's Huffman encoding.
- Unpacking was a matter of reading the correct number of bytes from __DATA__, decoding them, and then writing them.
If you don't need a
lot of compression, this might be something to look into. As I remember I was less worried about compression than I was about bundling and basically re-implemented
shar(1) in Perl.