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 add it to the search $PATH via software_set_export_path
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.
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.
software_ensure_terraform(version = 1.14.2, checksum)
Installs HashiCorp Terraform version 1.14.2
software_ensure_shellcheck(version = v0.8.0, checksum)
Installs ShellCheck shell script analysis tool version v0.8.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(version = 0.15.1, checksum = )
Install the restic backup solution
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_*
software_set_export_path
Updates $PATH to include all software downloaded with software_ensure_*