Add a Binary Payload to your Shell Scripts
Feb 20, 2009, 23:31 (1 Talkback[s])
(Other stories by Mitch Frazier)
Full Text Search: The Key to Better Natural Language Queries for NoSQL in Node.js
"Adding a binary payload to a shell script could, for instance,
be used to create a single file shell script that installs your
entire software package which could be composed of hundreds of
files. You merely append the tar or gzip file of your package as a
binary payload to the script file, when the script runs it extracts
the payload and does its task with the extracted files.
"For this example I assume the appended file is a tar.gz file.
The payload is appended to the end of an installation script
preceded by a marker line (PAYLOAD:). The appended data is either
uuencoded or just binary data. The script that follows takes a
single argument which should be the tar.gz to append to the
installation script. The installation script template install.sh.in
is copied to install.sh with the payload appended. This script is
named addpayload.sh follows:"