Skip to content

Commit

Permalink
1.3.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpeteuil committed Aug 28, 2018
1 parent 2583e83 commit f62b1b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Options:
- allows for unattended installation via scripts or CD tools
- can be set as default behavior by uncommenting line 12 (`sudoInstall=true`)
- sudo password may be required unless NOPASSWD is enabled
- `-c`: leave binary in working directory (for CI/DevOps use)
- `-h`: help
- `-v`: display version

Expand All @@ -44,7 +45,7 @@ Examples with Optional Parameters

``` shell
# -i = Install specific version
./terraform-install.sh -i 0.11.1
./terraform-install.sh -i 0.11.8

# -a = Automatic sudo install to /usr/local/bin/ (no user prompt)
./terraform-install.sh -a
Expand Down
16 changes: 11 additions & 5 deletions terraform-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# sudoInstall=true

scriptname=$(basename "$0")
scriptbuildnum="1.3.0"
scriptbuilddate="2018-05-13"
scriptbuildnum="1.3.1"
scriptbuilddate="2018-08-28"


# CHECK DEPENDANCIES AND SET NET RETRIEVAL TOOL
Expand Down Expand Up @@ -60,16 +60,18 @@ displayVer() {

usage() {
[[ "$1" ]] && echo -e "Download and Install Terraform - Latest Version unless '-i' specified\n"
echo -e "usage: ${scriptname} [-i VERSION] [-h] [-v]"
echo -e "usage: ${scriptname} [-i VERSION] [-a] [-c] [-h] [-v]"
echo -e " -i VERSION\t: specify version to install in format '$LATEST' (OPTIONAL)"
echo -e " -a\t\t: automatically use sudo to install to /usr/local/bin"
echo -e " -c\t\t: leave binary in working directory (for CI/DevOps use)"
echo -e " -h\t\t: help"
echo -e " -v\t\t: display ${scriptname} version"
}

while getopts ":i:ahv" arg; do
while getopts ":i:achv" arg; do
case "${arg}" in
a) sudoInstall=true;;
c) cwdInstall=true;;
i) VERSION=${OPTARG};;
h) usage x; exit;;
v) displayVer; exit;;
Expand Down Expand Up @@ -116,7 +118,11 @@ if [[ "$LINKVALID" != 200 ]]; then
fi

# DETERMINE DESTINATION
if [[ -w "/usr/local/bin" ]]; then
if [[ "$cwdInstall" ]]; then
BINDIR=$(pwd)
CMDPREFIX=""
STREAMLINED=true
elif [[ -w "/usr/local/bin" ]]; then
BINDIR="/usr/local/bin"
CMDPREFIX=""
STREAMLINED=true
Expand Down

0 comments on commit f62b1b9

Please sign in to comment.