Skip to content

Commit 8cba04c

Browse files
committed
add option for binary name
1 parent 6879752 commit 8cba04c

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

install.sh

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ Usage:
4545
Sets the prefix used by standalone release archives. Defaults to /usr/local
4646
and the binary is copied into /usr/local/bin
4747
To install in \$HOME, pass ---prefix=\$HOME/.local
48+
49+
--binary-name <name>
50+
Sets the name for the CLI in standalone release archives. Defaults to "coder"
51+
To use the CLI as coder2, pass --binary-name=coder2
52+
Note: in-product documentation will always refer to the CLI as "coder"
4853
4954
--rsh <bin>
5055
Specifies the remote shell for remote installation. Defaults to ssh.
@@ -79,28 +84,25 @@ echo_latest_version() {
7984
}
8085

8186
echo_standalone_postinstall() {
82-
if [ "$STANDALONE_INSTALL_PREFIX" = /usr/local ]; then
83-
cath <<EOF
84-
85-
Standalone release has been installed into /usr/local/bin/coder
87+
cath <<EOF
88+
Standalone release has been installed into $STANDALONE_INSTALL_PREFIX/bin/$STANDALONE_BINARY_NAME
8689
8790
EOF
88-
else
89-
cath <<EOF
90-
Standalone release has been installed into $STANDALONE_INSTALL_PREFIX/bin/coder
9191

92+
if [ "$STANDALONE_INSTALL_PREFIX" != /usr/local ]; then
93+
cath <<EOF
9294
Extend your path to use Coder:
9395
PATH="$STANDALONE_INSTALL_PREFIX/bin:\$PATH"
9496
9597
EOF
9698
fi
9799
cath <<EOF
98100
Run Coder (temporary):
99-
coder server --dev
101+
$STANDALONE_BINARY_NAME server --dev
100102
101103
Or run a production deployment with PostgreSQL:
102104
CODER_PG_CONNECTION_URL="postgres://<username>@<host>/<database>?password=<password>" \\
103-
coder server
105+
$STANDALONE_BINARY_NAME server
104106
105107
EOF
106108
}
@@ -165,6 +167,13 @@ main() {
165167
--prefix=*)
166168
STANDALONE_INSTALL_PREFIX="$(parse_arg "$@")"
167169
;;
170+
--binary-name)
171+
STANDALONE_BINARY_NAME="$(parse_arg "$@")"
172+
shift
173+
;;
174+
--binary-name=*)
175+
STANDALONE_BINARY_NAME="$(parse_arg "$@")"
176+
;;
168177
--version)
169178
VERSION="$(parse_arg "$@")"
170179
shift
@@ -225,6 +234,7 @@ main() {
225234
# releases in order to download and unpack the right release.
226235
CACHE_DIR=$(echo_cache_dir)
227236
STANDALONE_INSTALL_PREFIX=${STANDALONE_INSTALL_PREFIX:-/usr/local}
237+
STANDALONE_BINARY_NAME=${STANDALONE_BINARY_NAME:-coder}
228238
VERSION=${VERSION:-$(echo_latest_version)}
229239
# These can be overridden for testing but shouldn't normally be used as it can
230240
# result in a broken coder.
@@ -381,7 +391,7 @@ install_standalone() {
381391
"$sh_c" unzip -d "$CACHE_DIR" -o "$CACHE_DIR/coder_${VERSION}_${OS}_${ARCH}.zip"
382392
fi
383393

384-
"$sh_c" cp "$CACHE_DIR/coder" "$STANDALONE_INSTALL_PREFIX/bin/coder"
394+
"$sh_c" cp "$CACHE_DIR/coder" "$STANDALONE_INSTALL_PREFIX/bin/$STANDALONE_BINARY_NAME"
385395

386396
echo_standalone_postinstall
387397
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy