Skip to content

Commit 88972aa

Browse files
committed
v1.11 add -vers parm
1 parent 0413324 commit 88972aa

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

consul-download.sh

+31-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/usr/bin/env sh
22
# This is consul-download.sh at https://github.com/wilsonmar/mac-setup/blob/main/scripts/consul-download.sh
33
# This automates manual instructions at https://learn.hashicorp.com/tutorials/consul/deployment-guide?in=consul/production-deploy
4+
5+
# Copy and paste this:
6+
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/wilsonmar/mac-setup/master/consul-download.sh)"
7+
48
# This downloads and installs "safely" - verifying that what is downloaded has NOT been altered.
59
# 1. The fingerprint used here matches what the author saved in Keybase.
610
# 2. The author's hash of the downloaded file matches the hash created by the author.
@@ -9,10 +13,10 @@
913
# Techniques for shell scripting used here are explained at https://wilsonmar.github.io/shell-scripts
1014
# Explainer: https://serverfault.com/questions/896228/how-to-verify-a-file-using-an-asc-signature-file
1115

12-
# This is gas "v1.10 unzip just consul file"
16+
# This is git commit "v1.11 add -vers parm"
1317
# Kermit TODO: The expires: date above must be in the future ..."
1418
# Kermit? TODO: Change file name with time stamp instead of removing.
15-
# TODO: Add install of more utilities # To be hashi-agents-install.sh
19+
# TODO: Add install of more utilities # To be consul-download.sh
1620
# TODO: Add install of more HashiCorp programs: terraform, vault, consul-k8s, etc.
1721
# TODO: Add processing on other OS/Platforms.
1822

@@ -37,15 +41,17 @@ args_prompt() {
3741
echo " -q -quiet headings for each step"
3842
echo " -ni -no install of utilities brew, gpg2, jq, etc. (default is install)"
3943
echo " "
44+
echo " -vers list versions and stop"
4045
echo " -oss Install Open Source Sofware edition instead of default Enterprise edition"
4146
echo " -consul \"1.13.1\" Version of Consul"
4247
echo " -installdir \"/usr/local/bin\" target folder"
4348
echo " "
4449
echo "# USAGE EXAMPLES:"
45-
echo "chmod +x hashi-agents-install.sh # (one time) change permissions"
46-
echo "./hashi-agents-install.sh # assumes -ent and lates version available"
47-
echo "./hashi-agents-install.sh -v -oss"
48-
echo "./hashi-agents-install.sh -v -consul 1.13.1 # specific version"
50+
echo "chmod +x consul-download.sh # (one time) change permissions"
51+
echo "./consul-download.sh -vers # just list versions and stop"
52+
echo "./consul-download.sh # assumes -ent and lates version available"
53+
echo "./consul-download.sh -v -oss"
54+
echo "./consul-download.sh -v -consul 1.13.1 # specific version"
4955
} # args_prompt()
5056
#if [ $# -eq 0 ]; then # display if no parameters are provided:
5157
# args_prompt
@@ -56,6 +62,7 @@ args_prompt() {
5662
# Normal:
5763
CONTINUE_ON_ERR=false # -cont
5864
RUN_VERBOSE=false # -v
65+
LIST_VERSIONS=false # -vers
5966
RUN_DEBUG=false # -vv
6067
SET_TRACE=false # -x
6168
RUN_QUIET=false # -q
@@ -141,6 +148,10 @@ while test $# -gt 0; do
141148
export RUN_DEBUG=true
142149
shift
143150
;;
151+
-vers)
152+
export LIST_VERSIONS=true
153+
shift
154+
;;
144155
-v)
145156
export RUN_VERBOSE=true
146157
shift
@@ -214,6 +225,19 @@ fi
214225

215226
### 07. Verify parameters vs. exports defined on Terminal before invoking this:
216227

228+
if [ "${LIST_VERSIONS}" = true ]; then
229+
# Just the version codes:
230+
CONSUL_VER_LIST="https://releases.hashicorp.com/consul"
231+
open "${CONSUL_VER_LIST}"
232+
233+
if [ "${RUN_VERBOSE}" = true ]; then # -v
234+
# show website with description of each release:
235+
CONSUL_VER_LIST="https://github.com/hashicorp/consul/releases"
236+
open "${CONSUL_VER_LIST}"
237+
fi
238+
exit
239+
fi
240+
217241
# Instead of obtaining manually: https://docs.github.com/en/repositories/releasing-projects-on-github/linking-to-releases
218242
CONSUL_LATEST_VERSION=$( curl -sL "https://api.github.com/repos/hashicorp/consul/releases/latest" | jq -r ".tag_name" | cut -c2- )
219243

@@ -364,7 +388,7 @@ if ! command -v gpg ; then
364388
# Install gpg if needed: see https://wilsonmar.github.io/git-signing
365389
echo "*** brew install gnupg2 (gpg)..."
366390
brew install gnupg2
367-
chmod 700 ~/.gnupg
391+
# TODO: chmod 700 ~/.gnupg
368392
fi
369393
h2 "gpg import hashicorp.asc ..."
370394
# No Using gpg --list-keys @34365D9472D7468F to check if asc file is already been imported into keychain (a one-time process)

0 commit comments

Comments
 (0)