feat: add script for creating self-extracting archives
- 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
This commit is contained in:
19
sfx_header.sh
Normal file
19
sfx_header.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/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__
|
Reference in New Issue
Block a user