Skip to content

Commit c243210

Browse files
authored
fix(install.sh): change post-install advisory when installing specific version (coder#12878)
1 parent 61e5721 commit c243210

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

install.sh

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,19 @@ echo_standalone_postinstall() {
118118
return
119119
fi
120120

121-
channel=mainline
121+
channel=
122122
advisory="To install our stable release (v${STABLE_VERSION}), use the --stable flag. "
123-
if [ "${MAINLINE}" = 0 ]; then
124-
channel=stable
123+
if [ "${STABLE}" = 1 ]; then
124+
channel="stable "
125125
advisory=""
126126
fi
127+
if [ "${MAINLINE}" = 1 ]; then
128+
channel="mainline "
129+
fi
127130

128131
cath <<EOF
129132
130-
Coder ${channel} release v${VERSION} installed. ${advisory}See our releases documentation or GitHub for more information on versioning.
133+
Coder ${channel}release v${VERSION} installed. ${advisory}See our releases documentation or GitHub for more information on versioning.
131134
132135
The Coder binary has been placed in the following location:
133136
@@ -246,6 +249,7 @@ EOF
246249

247250
main() {
248251
MAINLINE=1
252+
STABLE=0
249253
TERRAFORM_VERSION="1.6.6"
250254

251255
if [ "${TRACE-}" ]; then
@@ -298,17 +302,25 @@ main() {
298302
;;
299303
--version)
300304
VERSION="$(parse_arg "$@")"
305+
MAINLINE=0
306+
STABLE=0
301307
shift
302308
;;
303309
--version=*)
304310
VERSION="$(parse_arg "$@")"
311+
MAINLINE=0
312+
STABLE=0
305313
;;
306314
# Support edge for backward compatibility.
307315
--mainline | --edge)
316+
VERSION=
308317
MAINLINE=1
318+
STABLE=0
309319
;;
310320
--stable)
321+
VERSION=
311322
MAINLINE=0
323+
STABLE=1
312324
;;
313325
--rsh)
314326
RSH="$(parse_arg "$@")"
@@ -390,12 +402,10 @@ main() {
390402
STANDALONE_INSTALL_PREFIX=${STANDALONE_INSTALL_PREFIX:-/usr/local}
391403
STANDALONE_BINARY_NAME=${STANDALONE_BINARY_NAME:-coder}
392404
STABLE_VERSION=$(echo_latest_stable_version)
393-
if [ -z "${VERSION}" ]; then
394-
if [ "${MAINLINE}" = 0 ]; then
395-
VERSION=${STABLE_VERSION}
396-
else
397-
VERSION=$(echo_latest_mainline_version)
398-
fi
405+
if [ "${MAINLINE}" = 1 ]; then
406+
VERSION=$(echo_latest_mainline_version)
407+
elif [ "${STABLE}" = 1 ]; then
408+
VERSION=${STABLE_VERSION}
399409
fi
400410

401411
distro_name
@@ -412,9 +422,14 @@ main() {
412422

413423
# If the version is the same as the stable version, we're installing
414424
# the stable version.
415-
if [ "${MAINLINE}" != 0 ] && [ "${VERSION}" = "${STABLE_VERSION}" ]; then
425+
if [ "${MAINLINE}" = 1 ] && [ "${VERSION}" = "${STABLE_VERSION}" ]; then
416426
echoh "The latest mainline version has been promoted to stable, selecting stable."
417427
MAINLINE=0
428+
STABLE=1
429+
fi
430+
# If the manually specified version is stable, mark it as such.
431+
if [ "${MAINLINE}" = 0 ] && [ "${STABLE}" = 0 ] && [ "${VERSION}" = "${STABLE_VERSION}" ]; then
432+
STABLE=1
418433
fi
419434

420435
# Standalone installs by pulling pre-built releases from GitHub.

0 commit comments

Comments
 (0)