Skip to content

Commit

Permalink
Merge pull request #5 from robertpeteuil/dev
Browse files Browse the repository at this point in the history
refine readme
  • Loading branch information
robertpeteuil authored Oct 28, 2022
2 parents 7c994af + 73b567a commit bf6f114
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 37 deletions.
87 changes: 53 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@

## Automate Download and Installation of HashiCorp binaries

<!-- [![release](https://img.shields.io/badge/release-1.0.0--beta.2-2067b8)](https://github.com/robertpeteuil/hashicorp-installer) -->
[![release](https://img.shields.io/github/release/robertpeteuil/hashicorp-installer?colorB=2067b8)](https://github.com/robertpeteuil/hashicorp-installer)
[![bash](https://img.shields.io/badge/language-bash-89e051.svg?style=flat-square)](https://github.com/robertpeteuil/hashicorp-installer)
[![license](https://img.shields.io/github/license/robertpeteuil/hashicorp-installer?colorB=2067b8)](https://github.com/robertpeteuil/hashicorp-installer)

---

**hcinstall.sh** automates the process of downloading and installing HashiCorp products. It supports all binaries on releases.hashicorp.com; including terraform, packer, vault, consul, boundary, waypoint, etc..
**hcinstall.sh** automates the process of downloading and installing HashiCorp products. It supports all binaries on [releases.hashicorp.com](https://releases.hashicorp.com); including [terraform](https://www.terraform.io/), [packer](https://www.packer.io/), [vault](https://www.vaultproject.io/), [consul](https://www.consul.io/), [boundary](https://www.boundaryproject.io/), [waypoint](https://www.waypointproject.io/), etc..

This script detects host architecture, searches for releases, downloads, verifies and installs binaries. Optional parameters allow finding latest patch releases, retrieving enterprise binaries, and functioning in special modes.

It can also be used to display the latest patch release for a given version without installation (using output only mode). For example, find the latest release in the Terraform 1.1 series: `hcinstall.sh -i 1.1 -o`.

This is an upgrade and replacement for the earlier projects: [Terraform Installer](https://github.com/robertpeteuil/terraform-installer) and [Packer Installer](https://github.com/robertpeteuil/packer-installer). It has been designed for easy migration and allows drop-in-replacement with minimal adjustments.

## Usage
## Use

```text
hcinstall.sh [-p PRODUCT] [-i VERSION] [-e] [-o] [-h] [-v] [-m] [-a] [-c] [-d]
Expand All @@ -37,56 +38,74 @@ hcinstall.sh [-p PRODUCT] [-i VERSION] [-e] [-o] [-h] [-v] [-m] [-a] [-c] [-d]
full names: https://releases.hashicorp.com
```

### Examples
## Download

Download latest release [^1] from my bootstrap server (iac.sh or https://iac.sh)

``` shell
curl iac.sh/hcinstall > hcinstall.sh
chmod +x hcinstall.sh
```

Download from GitHub

``` shell
curl -LO https://raw.github.com/robertpeteuil/hashicorp-installer/master/hcinstall.sh
chmod +x hcinstall.sh
```

[^1]: Releases automatically published to iac.sh via GitHub Actions

## Parameters

> specify product with `-p` flag
### Specifying Products `-p`

- defaults to Terraform if `-p` not specified
- `-p` not specified, defaults to Terraform
- `hcinstall.sh`
- install vault using product abbreviation
- specify product abbreviation (v = vault)
- `hcinstall.sh -p v`
- install consul-template using name
- specify full binary name
- `hcinstall.sh -p consul-template`

> specify version with `-i` flag
### Specifying Specific or Partial Versions `-i`

- install latest - don't specify version
- latest - don't specify `-i`
- `hcinstall.sh`
- install specific version - use MAJOR.MINOR.PATCH format
- specific version - use MAJOR.MINOR.PATCH format
- `hcinstall.sh -i 1.1.5`
- determine & install latest patch release - use MAJOR.MINOR format
- latest patch release - use MAJOR.MINOR format
- `hcinstall.sh -i 1.1`

### Override CPU detection on Apple Silicon (arm64)
### Output Only Mode `-o`

> On macOS hosts with Apple Silicon (arm64)
> find latest version or patch release, display info and exit without install
- by default, if installer detects Apple Silicon it attempts to install `arm64` binaries
- If `arm64` binaries aren't available for a given product + version, it reverts to `amd64` (Intel)
- To override detected CPU and force Intel binaries, use the `-m`
- ex: when using terraform with an older version of a provider that isn't available for arm64
- install the intel version of terraform with: `hcinstaller.sh -m`
- display latest version of Terraform
- `hcinstall.sh -o`
- display latest patch release for Vault 1.9
- `hcinstall.sh -p v -i 1.9 -o`

## Migration from Previous Installers
## Override arm64 binaries on macOS `-m`

- macOS on Apple Silicon
- previous installers assumed `amd64` cpu on macOS
- This installer will look for `darwin_arm64` binaries when Apple Silicon is detected
- If `darwin_arm64` binaries aren't available (for a given product/version), it reverts to Intel `darwin_amd64`
- you can force the old behavior (always use `amd64` binaries), with the `-m` parameter
- installing products other than terraform
- when replacing a previous installer with this one, add the `-p` parameter specifying the product to install
- If installer detects Apple Silicon it attempts to install `arm64` binaries
- If `arm64` binaries aren't available for a given product + version, it reverts to `amd64` (Intel)
- Force install of Intel binaries with `-m` flag
- Useful for Terraform when using use older provider versions that lack an `arm64` build
- the terraform binary and provider binary need to share the same cpu architecture

## Download and Use Locally
## Release Info

Download Installer
### Migration from Previous Installers

``` shell
curl -LO https://raw.github.com/robertpeteuil/hashicorp-installer/master/hcinstall.sh
chmod +x hcinstall.sh
```
- macOS on Apple Silicon
- behavior change from previous scripts when running on Apple Silicon Macs
- installer looks for `darwin_arm64` binaries when Apple Silicon is detected
- previous installers assumed `amd64` cpu on macOS
- force old behavior (always use `amd64` binaries), with the `-m` parameter
- installing products other than terraform
- use `-p` parameter specifying the product to install

## System Requirements
### System Requirements

- System with Bash Shell (Linux, macOS, Windows Subsystem for Linux)
- `curl` or `wget` - script will use either one to retrieve metadata and download
Expand Down
6 changes: 3 additions & 3 deletions hcinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ set -e
# sudoInstall=true
defaultProduct="terraform"

scriptname=$(basename "$0")
scriptbuildnum="1.0.0-beta.3"
scriptbuilddate="2022-10-26"
scriptname="hcinstall"
scriptbuildnum="1.0.0-beta.4"
scriptbuilddate="2022-10-27"

# CHECK DEPENDANCIES AND SET NET RETRIEVAL TOOL
if ! unzip -h 2&> /dev/null; then
Expand Down

0 comments on commit bf6f114

Please sign in to comment.