Software

Tooling setup for local development and continuous integration environments.

Based on the functionality from Download and File this library offers automatic installation for various software packages.

The packages will be downloaded to a local .cache directory, extracted to .bin directory and executed from there. This helps to avoid polluting the system with software only needed for your project and also avoids version conflicts in case other projects use different versions of the same tool.

Usage

Use the software_ensure_* to install the needed software and then it to the search $PATH via software_set_export_path

source "software.sh"

software_ensure_shellcheck
software_set_export_path

shellcheck -v

Overriding .cache and .bin directories

The .cache and .bin directory can be overwritten by setting $CACHE_DIR and $BIN_DIR before sourcing in the libraries. This can be useful in a continuous integration env to put the cache on a persistent storage to avoid re-downloading the software on every build.

export BIN_DIR="/tmp/bin"
export CACHE_DIR="/tmp/cache"

source "software.sh"

software_ensure_shellcheck

Functions

All functions can be called without any parameters and will then install the software in a recent version. An exact version and checksum for the downloaded can also be given to force a specific version.

source "software.sh"

software_ensure_terraform

software_ensure_terraform "0.13.4" "a92df4a151d390144040de5d18351301e597d3fae3679a814ea57554f6aa9b24"

software_ensure_terraform(version = 1.2.6, checksum)

Installs HashiCorp Terraform version 1.2.6

software_ensure_consul(version = 1.12.3, checksum)

Installs HashiCorp Consul version 1.12.3

software_ensure_hugo(version = 0.101.0, checksum)

Installs Hugo static site generator version 0.101.0

software_ensure_shellcheck(version = v0.8.0, checksum)

Installs ShellCheck shell script analysis tool version v0.8.0

software_ensure_semver(version = v1.1.0, checksum)

Installs semver a semantic versioning tool in version v1.1.0

software_ensure_terragrunt(version = 0.43.0, checksum)

Installs terragrunt a semantic versioning tool in version 0.43.0

software_hashicorp_ensure(product, version, checksum)

Generic wrapper for downloading HashiCorp tools built around the convention that product distributions are available at https://releases.hashicorp.com/${product}/${version}/${product}_${product}_linux_amd64.zip and the downloaded zip contains an executable named ${product} which will be written to ${bin_dir}.

software_hashicorp_ensure "nomad" "1.3.3" "d908811cebe2a8373e93c4ad3d09af5c706241878ff3f21ee0f182b4ecb571f2"

software_github_ensure_bin(user, repository, version, bin_name, checksum)

Generic wrapper for binary release download from Github built around the Github releases convention https://github.com/${user}/${repository}/releases/download/v${version}/${bin_name}_linux_amd64.

software_export_path

Creates a $PATH compatible path for all software downloaded with software_ensure_*

source "software.sh"

software_ensure_shellcheck

export PATH="${PATH}:$(software_export_path)"

shellcheck --version

software_set_export_path

Updates $PATH to include all software downloaded with software_ensure_*

source "software.sh"

software_ensure_hugo

software_set_export_path

hugo version