Skip to content

fix(install.sh): change post-install advisory when installing specific version #12878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,19 @@ echo_standalone_postinstall() {
return
fi

channel=mainline
channel=
advisory="To install our stable release (v${STABLE_VERSION}), use the --stable flag. "
if [ "${MAINLINE}" = 0 ]; then
channel=stable
if [ "${STABLE}" = 1 ]; then
channel="stable "
advisory=""
fi
if [ "${MAINLINE}" = 1 ]; then
channel="mainline "
fi

cath <<EOF

Coder ${channel} release v${VERSION} installed. ${advisory}See our releases documentation or GitHub for more information on versioning.
Coder ${channel}release v${VERSION} installed. ${advisory}See our releases documentation or GitHub for more information on versioning.

The Coder binary has been placed in the following location:

Expand Down Expand Up @@ -246,6 +249,7 @@ EOF

main() {
MAINLINE=1
STABLE=0
TERRAFORM_VERSION="1.6.6"

if [ "${TRACE-}" ]; then
Expand Down Expand Up @@ -298,17 +302,25 @@ main() {
;;
--version)
VERSION="$(parse_arg "$@")"
MAINLINE=0
STABLE=0
shift
;;
--version=*)
VERSION="$(parse_arg "$@")"
MAINLINE=0
STABLE=0
;;
# Support edge for backward compatibility.
--mainline | --edge)
VERSION=
MAINLINE=1
STABLE=0
;;
--stable)
VERSION=
MAINLINE=0
STABLE=1
;;
--rsh)
RSH="$(parse_arg "$@")"
Expand Down Expand Up @@ -390,12 +402,10 @@ main() {
STANDALONE_INSTALL_PREFIX=${STANDALONE_INSTALL_PREFIX:-/usr/local}
STANDALONE_BINARY_NAME=${STANDALONE_BINARY_NAME:-coder}
STABLE_VERSION=$(echo_latest_stable_version)
if [ -z "${VERSION}" ]; then
if [ "${MAINLINE}" = 0 ]; then
VERSION=${STABLE_VERSION}
else
VERSION=$(echo_latest_mainline_version)
fi
if [ "${MAINLINE}" = 1 ]; then
VERSION=$(echo_latest_mainline_version)
elif [ "${STABLE}" = 1 ]; then
VERSION=${STABLE_VERSION}
fi

distro_name
Expand All @@ -412,9 +422,14 @@ main() {

# If the version is the same as the stable version, we're installing
# the stable version.
if [ "${MAINLINE}" != 0 ] && [ "${VERSION}" = "${STABLE_VERSION}" ]; then
if [ "${MAINLINE}" = 1 ] && [ "${VERSION}" = "${STABLE_VERSION}" ]; then
echoh "The latest mainline version has been promoted to stable, selecting stable."
MAINLINE=0
STABLE=1
fi
# If the manually specified version is stable, mark it as such.
if [ "${MAINLINE}" = 0 ] && [ "${STABLE}" = 0 ] && [ "${VERSION}" = "${STABLE_VERSION}" ]; then
STABLE=1
fi

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