summaryrefslogtreecommitdiff
path: root/install-header.sh
diff options
context:
space:
mode:
Diffstat (limited to 'install-header.sh')
-rwxr-xr-xinstall-header.sh28
1 files changed, 24 insertions, 4 deletions
diff --git a/install-header.sh b/install-header.sh
index 200e9c5..1470c8f 100755
--- a/install-header.sh
+++ b/install-header.sh
@@ -7,7 +7,8 @@ LENS=( )
export SELF # Absolute path to the installer script (me!)
export TMP # Path to tmp install staging directory
export PAYLOAD # Path to the extracted payload directory
-export NOCLEANUP # Do not clean up deploy resources. Useful for debugging
+export NOCLEANUP=0 # Do not clean up deploy resources. Useful for debugging
+export EXTRACTONLY=0 # Execute extract, skipping deployment and cleanup
export DECOMPRESS='{{ DECOMPRESS }}' # Command to decompress data
# Header: 0
@@ -49,6 +50,8 @@ extract_payload() {
main() {
+ local args=(${@})
+
SELFDIR="$(cd $(dirname ${0}) && pwd)"
SELF="${SELFDIR}/$(basename ${0})"
TMP="$(mktemp -d /tmp/installer-XXXXXXX)"
@@ -65,15 +68,32 @@ main() {
source run.sh
- # Function 'deploy' is provided by run.sh
- if [ "$(type -t deploy)" == 'function' ]; then
+ for (( i = 0; i < ${#args[@]}; i++ )); do
+ # NOTE: Do not support short switches here to reduce the probability of
+ # conflicting with a switch provided by the downstream run.sh
+ if [ "${args[$i]}" = '--extract-only' ]; then
+ export EXTRACTONLY=1
+ export NOCLEANUP=1
+ fi
+ done
+
+ if [ "${EXTRACTONLY}" = '1' ]; then
+ printf 'Extracting...\n'
+ extract_payload
+ printf 'Installation payload available at "%s"\n' "${TMP}/pkg"
+ printf 'Skipping cleanup\n'
+ return 0
+ elif [ "$(type -t deploy)" == 'function' ]; then
+ # Function 'deploy' is provided by run.sh
deploy ${@}
else
printf "ERROR: Deploy function not found.\n"
fi
# Cleanup
- [ -z "${NOCLEANUP:-}" ] && rm -rf "${TMP}"
+ if [ "${NOCLEANUP}" -ne 0 ]; then
+ rm -rf "${TMP}"
+ fi
}
main ${@}

Generated by cgit