How would I go about making a self extracting archive that can be executed on sh
?
The closest I have come to is:
extract_archive () {
printf '<archive_contents>' | tar -C "$extract_dir" -xvf -
}
Where <archive_contents>
contains a tarball with null characters, %
, '
and \
characters escaped and enclosed between single quotes.
Is there any better way to do this so that no escaping is required?
(Please don't point me to shar
, makeself
etc. I want to write it from scratch.)