Skip to content

Commit 5c773d6

Browse files
authored
Merge pull request #99 from renproject/release/3.1.1
Release/3.1.1
2 parents 688e43a + d5392cd commit 5c773d6

5 files changed

Lines changed: 56 additions & 52 deletions

File tree

artifacts/install.sh

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,18 @@ main() {
3535
fi
3636
if ! check_cmd terraform; then
3737
terraform_url="https://releases.hashicorp.com/terraform/${cur_terraform_ver}/terraform_${cur_terraform_ver}_${ostype}_${cputype}.zip"
38-
ensure downloader "$terraform_url" "$HOME/.darknode/bin/terraform.zip"
39-
ensure unzip -qq "$HOME/.darknode/bin/terraform.zip" -d "$HOME/.darknode/bin"
40-
ensure chmod +x "$HOME/.darknode/bin/terraform"
41-
rm "$HOME/.darknode/bin/terraform.zip"
38+
39+
# The official terraform download page doesn't have bins for apple silicon before v1.0.0
40+
# so we have to build ourselves and upload to the cli release
41+
if [ "$ostype" = 'darwin' -a "$cputype" = 'arm64' ];then
42+
terraform_url="https://www.github.com/renproject/darknode-cli/releases/download/3.1.0/terraform_darwin_arm64"
43+
ensure downloader "$terraform_url" "$HOME/.darknode/bin/terraform"
44+
else
45+
ensure downloader "$terraform_url" "$HOME/.darknode/bin/terraform.zip"
46+
ensure unzip -qq "$HOME/.darknode/bin/terraform.zip" -d "$HOME/.darknode/bin"
47+
ensure chmod +x "$HOME/.darknode/bin/terraform"
48+
rm "$HOME/.darknode/bin/terraform.zip"
49+
fi
4250
fi
4351
progressBar 50 100
4452

@@ -98,13 +106,15 @@ prerequisites() {
98106
requiredPatch="$(echo $1 | cut -d. -f3)"
99107

100108
if [ "$major" -lt "$requiredMajor" ]; then
101-
err "Please upgrade your terraform to version above $min_terraform_ver"
102-
fi
103-
if [ "$minor" -lt "$requiredMinor" ]; then
104-
err "Please upgrade your terraform to version above $min_terraform_ver"
105-
fi
106-
if [ "$patch" -lt "$requiredPatch" ]; then
107-
err "Please upgrade your terraform to version above $min_terraform_ver"
109+
echo "Please upgrade your terraform to version above $min_terraform_ver"
110+
elif [ "$major" -eq "$requiredMajor" ]; then
111+
if [ "$minor" -lt "$requiredMinor" ]; then
112+
echo "Please upgrade your terraform to version above $min_terraform_ver"
113+
elif [ "$minor" -eq "$requiredMinor" ]; then
114+
if [ "$patch" -lt "$requiredPatch" ]; then
115+
echo "Please upgrade your terraform to version above $min_terraform_ver"
116+
fi
117+
fi
108118
fi
109119
fi
110120
}
@@ -118,7 +128,7 @@ check_architecture() {
118128
:
119129
elif [ "$ostype" = 'linux' -a "$cputype" = 'aarch64' ]; then
120130
:
121-
elif [ "$ostype" = 'darwin' -a "$cputype" = 'x86_64' ]; then
131+
elif [ "$ostype" = 'darwin' ]; then
122132
if [ "$cputype" = 'x86_64' ]; then
123133
:
124134
elif [ "$cputype" = 'arm64' ]; then
@@ -141,6 +151,9 @@ check_architecture() {
141151
11.*)
142152
# We assume Big Sur will be OK for now
143153
;;
154+
12.*)
155+
# We assume Monterey will be OK for now
156+
;;
144157
*)
145158
# Unknown product version, warn and continue
146159
echo "Warning: Detected unknown macOS major version: $(sw_vers -productVersion)"
@@ -209,14 +222,12 @@ ensure() {
209222
downloader() {
210223
if check_cmd curl; then
211224
if ! check_help_for curl --proto --tlsv1.2; then
212-
echo "Warning: Not forcing TLS v1.2, this is potentially less secure"
213225
curl --silent --show-error --fail --location "$1" --output "$2"
214226
else
215227
curl --proto '=https' --tlsv1.2 --silent --show-error --fail --location "$1" --output "$2"
216228
fi
217229
elif check_cmd wget; then
218230
if ! check_help_for wget --https-only --secure-protocol; then
219-
echo "Warning: Not forcing TLS v1.2, this is potentially less secure"
220231
wget "$1" -O "$2"
221232
else
222233
wget --https-only --secure-protocol=TLSv1_2 "$1" -O "$2"

artifacts/update.sh

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,23 @@ main(){
2323
requiredMinor="$(echo $min_terraform_ver | cut -d. -f2)"
2424
requiredPatch="$(echo $min_terraform_ver | cut -d. -f3)"
2525
if [ "$major" -lt "$requiredMajor" ]; then
26-
err "Please upgrade your terraform to version above $min_terraform_ver"
27-
fi
28-
if [ "$minor" -lt "$requiredMinor" ]; then
29-
err "Please upgrade your terraform to version above $min_terraform_ver"
30-
fi
31-
if [ "$patch" -lt "$requiredPatch" ]; then
32-
err "Please upgrade your terraform to version above $min_terraform_ver"
26+
echo "Please upgrade your terraform to version above $min_terraform_ver"
27+
elif [ "$major" -eq "$requiredMajor" ]; then
28+
if [ "$minor" -lt "$requiredMinor" ]; then
29+
echo "Please upgrade your terraform to version above $min_terraform_ver"
30+
elif [ "$minor" -eq "$requiredMinor" ]; then
31+
if [ "$patch" -lt "$requiredPatch" ]; then
32+
echo "Please upgrade your terraform to version above $min_terraform_ver"
33+
fi
34+
fi
3335
fi
3436
else
3537
install_terraform $cur_terraform_ver
3638
fi
3739
progressBar 40 100
3840

3941
# Update the binary
40-
current=$(darknode --version | grep "darknode-cli version" | cut -d ' ' -f 3)
42+
current=$(darknode --version | grep "Darknode CLI version" | cut -d ' ' -f 4)
4143
latest=$(get_latest_release "renproject/darknode-cli")
4244
vercomp $current $latest
4345
if [ "$?" -eq "2" ]; then
@@ -87,14 +89,12 @@ check_cmd() {
8789
downloader() {
8890
if check_cmd curl; then
8991
if ! check_help_for curl --proto --tlsv1.2; then
90-
echo "Warning: Not forcing TLS v1.2, this is potentially less secure"
9192
curl --silent --show-error --fail --location "$1" --output "$2"
9293
else
9394
curl --proto '=https' --tlsv1.2 --silent --show-error --fail --location "$1" --output "$2"
9495
fi
9596
elif check_cmd wget; then
9697
if ! check_help_for wget --https-only --secure-protocol; then
97-
echo "Warning: Not forcing TLS v1.2, this is potentially less secure"
9898
wget "$1" -O "$2"
9999
else
100100
wget --https-only --secure-protocol=TLSv1_2 "$1" -O "$2"
@@ -140,36 +140,31 @@ get_latest_release() {
140140
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
141141
}
142142

143-
# source : https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash
144143
vercomp () {
145144
if [[ $1 == $2 ]]
146145
then
147146
return 0
148147
fi
149-
local IFS=.
150-
local i ver1=($1) ver2=($2)
151-
# fill empty fields in ver1 with zeros
152-
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
153-
do
154-
ver1[i]=0
155-
done
156-
for ((i=0; i<${#ver1[@]}; i++))
157-
do
158-
if [[ -z ${ver2[i]} ]]
159-
then
160-
# fill empty fields in ver2 with zeros
161-
ver2[i]=0
162-
fi
163-
if ((10#${ver1[i]} > 10#${ver2[i]}))
164-
then
165-
return 1
148+
major1="$(echo $1 | cut -d. -f1)"
149+
minor1="$(echo $1 | cut -d. -f2)"
150+
patch1="$(echo $1 | cut -d. -f3)"
151+
major2="$(echo $2 | cut -d. -f1)"
152+
minor2="$(echo $2 | cut -d. -f2)"
153+
patch2="$(echo $2 | cut -d. -f3)"
154+
155+
if [ "$major1" -lt "$major2" ]; then
156+
return 2
157+
elif [ "$major1" -eq "$major2" ]; then
158+
if [ "$minor1" -lt "$minor2" ]; then
159+
return 2
160+
elif [ "$minor1" -eq "$minor2" ]; then
161+
if [ "$patch1" -lt "$patch2" ]; then
162+
return 2
166163
fi
167-
if ((10#${ver1[i]} < 10#${ver2[i]}))
168-
then
169-
return 2
170-
fi
171-
done
172-
return 0
164+
fi
165+
fi
166+
167+
return 1
173168
}
174169

175170
# Source: https://github.com/fearside/ProgressBar

cmd/down.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,4 @@ func nodeStatus(name string) (status, error) {
282282
return notRefunded, nil
283283
}
284284
return nilStatus, nil
285-
}
285+
}

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ require (
2020
github.com/jbenet/go-base58 v0.0.0-20150317085156-6237cf65f3a6
2121
github.com/karalabe/usb v0.0.0-20211005121534-4c5740d64559 // indirect
2222
github.com/kr/text v0.2.0 // indirect
23-
github.com/mattn/go-colorable v0.1.8 // indirect
2423
github.com/multiformats/go-multiaddr v0.1.1
2524
github.com/multiformats/go-multihash v0.0.8
2625
github.com/olekukonko/tablewriter v0.0.5 // indirect

go.sum

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
241241
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
242242
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
243243
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
244+
github.com/mattn/go-colorable v0.1.7 h1:bQGKb3vps/j0E9GfJQ03JyhRuxsvdAanXlT9BTw3mdw=
244245
github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
245-
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
246-
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
247246
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
248247
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
249248
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=

0 commit comments

Comments
 (0)