@@ -26,18 +26,21 @@ The remote host must have internet access.
26
26
${not_curl_usage-}
27
27
Usage:
28
28
29
- $arg0 [--dry-run] [--version X.X.X] [--edge ] [--method detect] \
29
+ ${ arg0} [--dry-run] [--mainline | --stable | -- version X.X.X] [--method detect] \
30
30
[--prefix ~/.local] [--rsh ssh] [user@host]
31
31
32
32
--dry-run
33
33
Echo the commands for the install process without running them.
34
34
35
+ --mainline
36
+ Install the latest mainline version (default).
37
+
38
+ --stable
39
+ Install the latest stable version instead of the latest mainline version.
40
+
35
41
--version X.X.X
36
42
Install a specific version instead of the latest.
37
43
38
- --edge
39
- Install the latest edge version instead of the latest stable version.
40
-
41
44
--method [detect | standalone]
42
45
Choose the installation method. Defaults to detect.
43
46
- detect detects the system package manager and tries to use it.
@@ -88,16 +91,25 @@ The installer will cache all downloaded assets into ~/.cache/coder
88
91
EOF
89
92
}
90
93
91
- echo_latest_version () {
92
- if [ " ${EDGE-} " ]; then
93
- version=" $( curl -fsSL https://api.github.com/repos/coder/coder/releases | awk ' match($0,/.*"html_url": "(.*\/releases\/tag\/.*)".*/)' | head -n 1 | awk -F ' "' ' {print $4}' ) "
94
- else
95
- # https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-2758860
96
- version=" $( curl -fsSLI -o /dev/null -w " %{url_effective}" https://github.com/coder/coder/releases/latest) "
97
- fi
98
- version=" ${version# https:// github.com/ coder/ coder/ releases/ tag/ } "
99
- version=" ${version# v} "
100
- echo " $version "
94
+ echo_latest_stable_version () {
95
+ # https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-2758860
96
+ version=" $( curl -fsSLI -o /dev/null -w " %{url_effective}" https://github.com/coder/coder/releases/latest) "
97
+ version=" ${version# https:// github.com/ coder/ coder/ releases/ tag/ v} "
98
+ echo " ${version} "
99
+ }
100
+
101
+ echo_latest_mainline_version () {
102
+ # Fetch the releases from the GitHub API, sort by version number,
103
+ # and take the first result. Note that we're sorting by space-
104
+ # separated numbers and without utilizing the sort -V flag for the
105
+ # best compatibility.
106
+ curl -fsSL https://api.github.com/repos/coder/coder/releases |
107
+ awk -F' "' ' /"tag_name"/ {print $4}' |
108
+ tr -d v |
109
+ tr . ' ' |
110
+ sort -k1,1nr -k2,2nr -k3,3nr |
111
+ head -n1 |
112
+ tr ' ' .
101
113
}
102
114
103
115
echo_standalone_postinstall () {
@@ -106,9 +118,18 @@ echo_standalone_postinstall() {
106
118
return
107
119
fi
108
120
121
+ channel=mainline
122
+ advisory=" To install our stable release (v${STABLE_VERSION} ), use the --stable flag. "
123
+ if [ " ${MAINLINE} " = 0 ]; then
124
+ channel=stable
125
+ advisory=" "
126
+ fi
127
+
109
128
cath << EOF
110
129
111
- Coder has been installed to
130
+ Coder ${channel} release v${VERSION} installed. ${advisory} See our releases documentation or GitHub for more information on versioning.
131
+
132
+ The Coder binary has been placed in the following location:
112
133
113
134
$STANDALONE_INSTALL_PREFIX /bin/$STANDALONE_BINARY_NAME
114
135
@@ -218,12 +239,13 @@ There is another binary in your PATH that conflicts with the binary we've instal
218
239
219
240
This is likely because of an existing installation of Coder. See our documentation for suggestions on how to resolve this.
220
241
221
- https://coder.com/docs/v2/latest/install/install.sh#path-conflicts
242
+ https://coder.com/docs/v2/latest/install/install.sh#path-conflicts
222
243
223
244
EOF
224
245
}
225
246
226
247
main () {
248
+ MAINLINE=1
227
249
TERRAFORM_VERSION=" 1.6.6"
228
250
229
251
if [ " ${TRACE-} " ]; then
@@ -236,7 +258,6 @@ main() {
236
258
OPTIONAL \
237
259
ALL_FLAGS \
238
260
RSH_ARGS \
239
- EDGE \
240
261
RSH \
241
262
WITH_TERRAFORM \
242
263
CAP_NET_ADMIN
@@ -282,8 +303,12 @@ main() {
282
303
--version=* )
283
304
VERSION=" $( parse_arg " $@ " ) "
284
305
;;
285
- --edge)
286
- EDGE=1
306
+ # Support edge for backward compatibility.
307
+ --mainline | --edge)
308
+ MAINLINE=1
309
+ ;;
310
+ --stable)
311
+ MAINLINE=0
287
312
;;
288
313
--rsh)
289
314
RSH=" $( parse_arg " $@ " ) "
@@ -364,7 +389,12 @@ main() {
364
389
TERRAFORM_INSTALL_PREFIX=${TERRAFORM_INSTALL_PREFIX:-/ usr/ local}
365
390
STANDALONE_INSTALL_PREFIX=${STANDALONE_INSTALL_PREFIX:-/ usr/ local}
366
391
STANDALONE_BINARY_NAME=${STANDALONE_BINARY_NAME:- coder}
367
- VERSION=${VERSION:- $(echo_latest_version)}
392
+ STABLE_VERSION=$( echo_latest_stable_version)
393
+ if [ " ${MAINLINE} " = 0 ]; then
394
+ VERSION=${STABLE_VERSION}
395
+ else
396
+ VERSION=$( echo_latest_mainline_version)
397
+ fi
368
398
369
399
distro_name
370
400
@@ -378,6 +408,13 @@ main() {
378
408
with_terraform
379
409
fi
380
410
411
+ # If the version is the same as the stable version, we're installing
412
+ # the stable version.
413
+ if [ " ${MAINLINE} " != 0 ] && [ " ${VERSION} " = " ${STABLE_VERSION} " ]; then
414
+ echoh " The latest mainline version has been promoted to stable, selecting stable."
415
+ MAINLINE=0
416
+ fi
417
+
381
418
# Standalone installs by pulling pre-built releases from GitHub.
382
419
if [ " $METHOD " = standalone ]; then
383
420
if has_standalone; then
0 commit comments