Skip to content

Commit

Permalink
removed curl dependancy
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpeteuil committed Apr 11, 2018
1 parent f494b8c commit 0d0afc9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ Options:
- install specific version: `-i VERSION`
- automatically `sudo` install to /usr/local/bin: `-a`
- prevents user prompt asking for install destination
- user must enter sudo password unless NOPASSWD is enabled
- uncomment line 12 to make this the default behavior (`sudoInstall=true`)
- user will still need to enter sudo password unless NOPASSWD is enabled
- set as default behavior by uncommenting line 12 (`sudoInstall=true`)

### Installation with this Installer

Download the installer and make executable

``` shell
curl -LO https://raw.github.com/robertpeteuil/terraform-installer/master/terraform-install.sh
wget https://raw.github.com/robertpeteuil/terraform-installer/master/terraform-install.sh
chmod +x terraform-install.sh
```

Expand All @@ -39,7 +39,7 @@ Optional Parameters
# -i = Install specific version
./terraform-install.sh -i 0.11.1

# -a = Automatic sudo install to /usr/local/bin/
# -a = Automatic sudo install to /usr/local/bin/ (no user prompt)
./terraform-install.sh -a
```

Expand All @@ -53,8 +53,7 @@ Optional Parameters
### System Requirements

- System with Bash Shell (Linux, macOS, Windows Subsystem for Linux)
- `curl`
- `unzip` - terraform downloads in zip format
- `unzip` - terraform downloads are in zip format

### Script Process Details

Expand Down
6 changes: 3 additions & 3 deletions terraform-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# sudoInstall=true

scriptname=$(basename "$0")
scriptbuildnum="1.1.3"
scriptbuildnum="1.2.0"
scriptbuilddate="2018-04-11"

LATEST=$(wget -q -O- https://api.github.com/repos/hashicorp/terraform/releases/latest 2> /dev/null | awk '/tag_name/ {print $2}' | cut -d '"' -f 2 | cut -d 'v' -f 2)
Expand Down Expand Up @@ -65,7 +65,7 @@ fi
# CREATE FILENAME AND DOWNLOAD LINK BASED ON GATHERED PARAMETERS
FILENAME="terraform_${VERSION}_${OS}_${PROC}.zip"
LINK="https://releases.hashicorp.com/terraform/${VERSION}/${FILENAME}"
LINKVALID=$(curl -o /dev/null --silent --head --write-out '%{http_code}\n' "$LINK")
LINKVALID=$(wget --spider -S "$LINK" 2>&1 | grep "HTTP/" | awk '{print $2}')

# VERIFY LINK VALIDITY
if [[ "$LINKVALID" != 200 ]]; then
Expand Down Expand Up @@ -113,7 +113,7 @@ mkdir -p "$UTILTMPDIR"
cd "$UTILTMPDIR" || exit 1

# DOWNLOAD AND EXTRACT
curl -s -o "$FILENAME" "$LINK"
wget -q "$LINK" -O "$FILENAME"
unzip -qq "$FILENAME" || exit 1

# COPY TO DESTINATION
Expand Down

0 comments on commit 0d0afc9

Please sign in to comment.