@@ -91,38 +91,45 @@ The installer will cache all downloaded assets into ~/.cache/coder
91
91
EOF
92
92
}
93
93
94
- echo_latest_version () {
95
- if [ " ${MAINLINE} " = 0 ]; then
96
- # https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-2758860
97
- version=" $( curl -fsSLI -o /dev/null -w " %{url_effective}" https://github.com/coder/coder/releases/latest) "
98
- version=" ${version# https:// github.com/ coder/ coder/ releases/ tag/ v} "
99
- else
100
- # Fetch the releases from the GitHub API, sort by version number,
101
- # and take the first result. Note that we're sorting by space-
102
- # separated numbers and without utilizing the sort -V flag for the
103
- # best compatibility.
104
- version=" $(
105
- curl -fsSL https://api.github.com/repos/coder/coder/releases |
106
- awk -F' "' ' /"tag_name"/ {print $4}' |
107
- tr -d v |
108
- tr . ' ' |
109
- sort -k1,1nr -k2,2nr -k3,3nr |
110
- head -n1 |
111
- tr ' ' .
112
- ) "
113
- fi
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} "
114
98
echo " ${version} "
115
99
}
116
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 ' ' .
113
+ }
114
+
117
115
echo_standalone_postinstall () {
118
116
if [ " ${DRY_RUN-} " ]; then
119
117
echo_dryrun_postinstall
120
118
return
121
119
fi
122
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
+
123
128
cath << EOF
124
129
125
- 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:
126
133
127
134
$STANDALONE_INSTALL_PREFIX /bin/$STANDALONE_BINARY_NAME
128
135
@@ -232,7 +239,7 @@ There is another binary in your PATH that conflicts with the binary we've instal
232
239
233
240
This is likely because of an existing installation of Coder. See our documentation for suggestions on how to resolve this.
234
241
235
- https://coder.com/docs/v2/latest/install/install.sh#path-conflicts
242
+ https://coder.com/docs/v2/latest/install/install.sh#path-conflicts
236
243
237
244
EOF
238
245
}
@@ -382,7 +389,12 @@ main() {
382
389
TERRAFORM_INSTALL_PREFIX=${TERRAFORM_INSTALL_PREFIX:-/ usr/ local}
383
390
STANDALONE_INSTALL_PREFIX=${STANDALONE_INSTALL_PREFIX:-/ usr/ local}
384
391
STANDALONE_BINARY_NAME=${STANDALONE_BINARY_NAME:- coder}
385
- 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
386
398
387
399
distro_name
388
400
@@ -396,6 +408,13 @@ main() {
396
408
with_terraform
397
409
fi
398
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
+
399
418
# Standalone installs by pulling pre-built releases from GitHub.
400
419
if [ " $METHOD " = standalone ]; then
401
420
if has_standalone; then
0 commit comments