Makeself is a small command-line utility to generate self-extracting archives for Unix. It is pretty popular and it is used by VirtualBox and CMake projects.

Makeself creates archives that are just small startup scripts (.run, .bin or .sh) concatenated with tarballs.

When you run such self-extracting archive:

  • A small script (shim) extracts the embedded archive into the temporary directory

  • Script passes the execution to the entry point within the unpacked archive

  • application is being run

  • The temporary directory removed

Therefore, it transparently appears just like a normal application execution.

With help of deploy generator, it’s only needed to invoke in order to generate self-extracting archive for the further deployment:

TMPDIR=`dirname $(mktemp -u -t tmp.XXXXXXXXXX)`
curl "" --output $TMPDIR/ -L
chmod +x $TMPDIR/
$TMPDIR/ --target $TMPDIR/makeself
$TMPDIR/makeself/ $PREFIX "conan-generated" "./"

The PREFIX variable in the example points to the directory where binary artifacts are situated. The is an output SFX archive:

$ file POSIX shell script executable (binary data)

The is a simple script which sets requires variables (like PATH or LD_LIBRARY_PATH):

#!/usr/bin/env bash
set -ex
export PATH=$PATH:$PWD/bin
pushd $(dirname $PWD/md5)
$(basename $PWD/md5)

Check out the complete example on GitHub.