[aklug] Self-extracting Archive

From: Christopher Howard <choward@indicium.us>
Date: Fri May 08 2009 - 15:53:25 AKDT

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm trying to create a self-extracting archive/installer by following
some online-instructions, but it doesn't seem to be working. Can anyone
tell me what is wrong with this script?

#!/bin/bash

echo ""
echo "Self Extracting Installer"
echo ""

export TMPDIR=`mktemp -d /tmp/selfextract.1029349304`

ARCHIVE=`awk '/^__ARCHIVE_BELOW__/ {print NR + 1; exit 0; }' $0`

tail -n+$ARCHIVE $0 | tar xzv -C $TMPDIR

CDIR=`pwd`
cd $TMPDIR
./installer.sh

cd $CDIR
rm -rf $TMPDIR

exit 0

__ARCHIVE_BELOW__

I cat a tar.gz archive onto the end of this script, and then execute it
to see if it works. When I run it, it outputs the echo message, but then
ramps my cpu load up to 100% and hangs there until I kill it. When I
kill it, I get this output:

tar: option requires an argument -- C
Try `tar --help' or `tar --usage' for more information.
./test.bsx: line 14: ./installer.sh: No such file or directory

I have an overarching perspective of what the script is doing, but my
awk, bash, and tar skills are not very far developed, so I'm not sure
what is going wrong.

- --
Christopher Howard
http://indicium.us
http://theologia.indicium.us

I digitally sign /all/ of my e-mails via PGP. If you receive any e-mail
from me without my valid PGP signature, please take additional steps to
verify the authenticity of the message.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkoExfQACgkQQ5FLNdi0BcVsrwCghghG54ZxWm2rhe+TCE/WOBKe
YNwAoI1J1Zhek8fAEHIngTYvLDLO+z7+
=RHA9
-----END PGP SIGNATURE-----
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Fri May 8 15:53:36 2009

This archive was generated by hypermail 2.1.8 : Fri May 08 2009 - 15:53:36 AKDT