diff --git a/target/scripts/build/packages.sh b/target/scripts/build/packages.sh index 6dfea339..6be95d79 100644 --- a/target/scripts/build/packages.sh +++ b/target/scripts/build/packages.sh @@ -36,7 +36,17 @@ function _pre_installation_steps() { apt-get "${QUIET}" install --no-install-recommends "${EARLY_PACKAGES[@]}" 2>/dev/null } +# Install third-party commands to /usr/local/bin function _install_utils() { + local ARCH_A=$(uname -m) + # Alternate naming convention support: x86_64 (amd64) / aarch64 (arm64) + # https://en.wikipedia.org/wiki/X86-64#Industry_naming_conventions + local ARCH_B + case "${ARCH_A}" in + ( 'x86_64' ) ARCH_B='amd64' ;; + ( 'aarch64' ) ARCH_B='arm64' ;; + esac + # TIP: `*.tar.gz` releases tend to forget to reset UID/GID ownership when archiving. # When extracting with `tar` as `root` the archived UID/GID is kept, unless using `--no-same-owner`. # Likewise when the binary is in a nested location the full archived path @@ -49,6 +59,11 @@ function _install_utils() { curl -sSfL "https://github.com/01mf02/jaq/releases/download/${JAQ_TAG}/jaq-$(uname -m)-unknown-linux-gnu" -o /usr/local/bin/jaq chmod +x /usr/local/bin/jaq + _log 'trace' 'Installing step' + local STEP_RELEASE='0.28.2' + curl -sSfL "https://github.com/smallstep/cli/releases/download/v${STEP_RELEASE}/step_linux_${STEP_RELEASE}_${ARCH_B}.tar.gz" \ + | tar -xz --directory /usr/local/bin --no-same-owner --strip-components=2 "step_${STEP_RELEASE}/bin/step" + _log 'trace' 'Installing swaks' # `perl-doc` is required for `swaks --help` to work: apt-get "${QUIET}" install --no-install-recommends perl-doc