summaryrefslogtreecommitdiff
path: root/install-header.sh
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2018-04-09 15:45:45 -0600
committerAaron Ball <nullspoon@oper.io>2018-04-09 15:45:45 -0600
commitb6ef2c83429bfeba68c131445e6dd29cc04a2f83 (patch)
tree69906a459138138b1f51fc79fb26f8631c3be6e9 /install-header.sh
parente65c119036e53bdde6690820b42c475c5a90a98f (diff)
downloadpkgself-master.tar.gz
pkgself-master.tar.xz
install-header: Added --extract-only switchHEADmaster
This switch skips the deploy function as well as the cleanup process, executing the extraction process before exiting. This will enable easier debugging. Note that this switch does not support a short version to avoid risk of conflicting with downstream run.sh-provided switches (eg: -e).
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