#!/bin/sh methods="/usr/local/methods" [ -z $SFX_METHODS_DIR ]||methods=$SFX_METHODS_DIR [ `echo $1|grep -c tgz` -lt 1 ] && { clear cat < file ...' to create the archive, then run 'sfx' to make it self-extracting. Syntax: sfx [method] sfx [-] - Convert back to . method The type of action to be taken after extraction. If no method is specified, 'sfx' defaults to 'unzip'. See the 'sfx' man page for the specifics of each method. The available methods are: ! for n in $methods/*.met; do echo " "$(basename $n .met); done echo echo exit } [ ! -f $1 ] && { echo echo "Whatchu talkin' 'bout, Willis? I can't find any $1"'!' echo exit } if [ -n "$2" ] then if [ x$2 == "x-" ] then L=`head -2 $1|tail -1|tail -c +3` if [ `head -1 $1` != '#!/bin/sh' ] then echo "This doesn't look like an SFX archive; can't convert." exit fi tail -c +$L $1 > ${1%.sfx} rm $1 exit fi if [ `ls -1 $methods|grep -c $2` -lt 1 ] then echo echo "Not a valid method. Type 'sfx' to see the available methods." echo echo exit else cat $methods/$2.met $1 > $1.sfx; chmod +x $1.sfx; rm $1 fi else cat $methods/unzip.met $1 > $1.sfx; chmod +x $1.sfx; rm $1 fi