- Introduces a script to build self-extracting archives with validation - Includes payload compression, placeholder replacement, and output creation - Adds a header script to extract and execute the embedded entrypoint
20 lines
363 B
Bash
20 lines
363 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
TMPDIR="$(mktemp -d "${TMPDIR:-/tmp}/sfx.XXXXXX")"
|
|
ARCHIVE_LINE=__ARCHIVE_LINE__
|
|
|
|
cleanup() {
|
|
rm -rf "$TMPDIR"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
tail -n +$ARCHIVE_LINE "$0" | unzstd | tar -xf - -C "$TMPDIR"
|
|
|
|
ENTRYPOINT="$TMPDIR/__ENTRYPOINT__"
|
|
chmod +x "$ENTRYPOINT"
|
|
"$ENTRYPOINT" "$@"
|
|
exit_code=$?
|
|
exit $exit_code
|
|
__ARCHIVE_BEGIN__
|