@@ -126,11 +126,13 @@ rmm_agent_type=$8
126
126
# # Uninstall var for easy scription
127
127
mesh_fqdn=$2
128
128
mesh_id=$3
129
+ # # Setting Go verison to be installed
130
+ go_version=" 1.21.5"
129
131
130
- go_url_amd64=" https://go.dev/dl/go1.21.5 .linux-amd64.tar.gz"
131
- go_url_x86=" https://go.dev/dl/go1.21.5 .linux-386.tar.gz"
132
- go_url_arm64=" https://go.dev/dl/go1.21.5 .linux-arm64.tar.gz"
133
- go_url_armv6=" https://go.dev/dl/go1.21.5 .linux-armv6l.tar.gz"
132
+ go_url_amd64=" https://go.dev/dl/go $go_version .linux-amd64.tar.gz"
133
+ go_url_x86=" https://go.dev/dl/go $go_version .linux-386.tar.gz"
134
+ go_url_arm64=" https://go.dev/dl/go $go_version .linux-arm64.tar.gz"
135
+ go_url_armv6=" https://go.dev/dl/go $go_version .linux-armv6l.tar.gz"
134
136
135
137
function go_install() {
136
138
if ! command -v go & > /dev/null; then
@@ -156,9 +158,40 @@ function go_install() {
156
158
export GOPATH=/usr/local/go
157
159
export GOCACHE=/root/.cache/go-build
158
160
159
- echo " Golang Install Done ! "
161
+ echo " Go is installed (version $go_current_version ). "
160
162
else
161
- echo " Go is already installed"
163
+ # Get the current version of Go installed
164
+ go_current_version=$( go version | awk ' {print $3}' | sed ' s/go//' )
165
+
166
+ if [ " $go_current_version " != " $go_version " ]; then
167
+ echo " Version mismatch. Current installed version is $go_current_version . Desired version is $go_version ."
168
+ echo " Installing Go $go_version ..."
169
+ # # Installing golang
170
+ case $system in
171
+ amd64)
172
+ wget -O /tmp/golang.tar.gz $go_url_amd64
173
+ ;;
174
+ x86)
175
+ wget -O /tmp/golang.tar.gz $go_url_x86
176
+ ;;
177
+ arm64)
178
+ wget -O /tmp/golang.tar.gz $go_url_arm64
179
+ ;;
180
+ armv6)
181
+ wget -O /tmp/golang.tar.gz $go_url_armv6
182
+ ;;
183
+ esac
184
+
185
+ rm -rvf /usr/local/go/
186
+ tar -xvzf /tmp/golang.tar.gz -C /usr/local/
187
+ rm /tmp/golang.tar.gz
188
+ export GOPATH=/usr/local/go
189
+ export GOCACHE=/root/.cache/go-build
190
+
191
+ echo " Go $go_version installed."
192
+ else
193
+ echo " Go is up to date (version $go_current_version )."
194
+ fi
162
195
fi
163
196
}
164
197
0 commit comments