Fehérke's GitHub Site == glue between Fehérke's GitHub hosted projects

mksfx.sh - make selfextracting compressed file

This one was not written to fit my necessity. And beside this, was written in a hurry. So is not as flexible as could be, but does a nice work. I do not really care about the number of typed commands, but when I work on a remote machine doing something boring, then I prefer this kind of automation. So the script has good chances to evolve. Although it is quiet simple to do this by hand :

Bash script

(
cat <<END_OF_TEXT
#! /bin/bash
tail +5 "\$0" | tar xz -C /tmp/whatcompress
/tmp/whatcompress/whatrun.sh
exit 0
END_OF_TEXT
tar cfz - /whatcompress
) > whatcreate.sfx

Usage

mksfx.sh makes this easier. You can achieve the above, and evidently even more, with this command :

sample output - mksfx.sh -x whatcreate.sfx -c gzip -r whatrun.sh /whatcompress

SFX /whatcompress -> whatcreate.sh : gzip... sfx... add... Ok

Only a few parameters are implemented :

sample output - mksfx.sh --help

Make SelFeXtracting archive   version 1.1   august 2008   written by Feherke
create compressed tar of a directory and add an autoextract header
Syntax :
  mksfx.sh [-x sfxname] [-c compression] [-r runname] [directory]
Parameters :
  directory  - name of the directory to compress ( . )
  -x sfxname | --sfx=sfxname  - file name to create ( same as directory )
  -c compression | --compress=compression  - method : gzip, bzip2 ( gzip )
  -r runname | --run=runname  - file to run after uncompressing ( run.sh )
( The values between paranthesis are the default values. )

Configuration

None.

The only way duplicated.sh’s activity can be influenced, are the command line parameters.

Versions

Plans

Download

You can find the related files on GitHub in my Bash-script repository’s mksfx directory :