diff options
author | Aaron Ball <nullspoon@oper.io> | 2018-02-05 22:49:44 -0700 |
---|---|---|
committer | Aaron Ball <nullspoon@oper.io> | 2018-02-05 22:49:44 -0700 |
commit | 935701aeb500ee3dbdf20af998b1553b0d3dba34 (patch) | |
tree | b5e1b73ffdb9518ea2c058811caa0d8c66b209cc /install-header.sh | |
parent | a942935d2bb03683a6c632abf36ed75717717cc1 (diff) | |
download | pkgself-935701aeb500ee3dbdf20af998b1553b0d3dba34.tar.gz pkgself-935701aeb500ee3dbdf20af998b1553b0d3dba34.tar.xz |
Initial commit of support for libinstall resources
The libinstall resources will be used for packaging installation
libraries, such as a basic templating engine or simple shortcut
functions and aliases.
Updated LENS array to allow for an additional 8 byte archive. Also
updated archive index. Now...
1. header
2. libinstall
3. run.sh
4. payload
Added extract_libinstall function.
Along with this, also added the new libtemplate, which provides a very
basic templating engine to be used by the end user run.sh script if
needed.
Diffstat (limited to 'install-header.sh')
-rwxr-xr-x | install-header.sh | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/install-header.sh b/install-header.sh index 766ba0a..a7b9269 100755 --- a/install-header.sh +++ b/install-header.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash -# This is a pre-allocated string of 30 chars of whitespace +# This is a pre-allocated string of 39 chars of whitespace # DO NOT CHANGE THIS without great care - it will break header length # calculations -LENS=( ) +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 @@ -23,7 +23,7 @@ extract_chunk_index() { skip=$(( skip + LENS[$i] )) done - [ "${dest}" != '-' ] && of="${dest}" + [ "${dest}" != '-' ] && of="of=${dest}" # Extract the requested chunk index dd bs=1 count=${LENS[$index]} iflag=skip_bytes skip=${skip} \ if=${src} ${of} 2>/dev/null @@ -33,12 +33,16 @@ extract_header() { extract_chunk_index "${SELF}" "${TMP}/header.sh" 0 } +extract_libinstall() { + extract_chunk_index "${SELF}" '-' 1 | xz -d -c | tar -C "${TMP}" -x +} + extract_runscript() { - extract_chunk_index "${SELF}" '-' 1 | xz -d -c > "${TMP}/run.sh" + extract_chunk_index "${SELF}" '-' 2 | xz -d -c > "${TMP}/run.sh" } extract_payload() { - extract_chunk_index "${SELF}" '-' 2 | xz -d -c | tar -C "${TMP}" -x + extract_chunk_index "${SELF}" '-' 3 | xz -d -c | tar -C "${TMP}" -x export PAYLOAD="${TMP}/pkg" } @@ -48,10 +52,13 @@ main() { TMP="$(mktemp -d /tmp/installer-XXXXXXX)" extract_header + extract_libinstall extract_runscript - #extract_chunks "${self}" "${tmp}" cd "${TMP}" + + source libinstall/template.sh + source run.sh # Function 'deploy' is provided by run.sh |