@@ -104,29 +104,18 @@ Standalone release has been installed into $STANDALONE_INSTALL_PREFIX/bin/$STAND
104
104
105
105
EOF
106
106
107
- CODER_COMMAND=" $( command -v " $STANDALONE_BINARY_NAME " ) "
108
-
109
- if [ ! " $CODER_COMMAND " ]; then
107
+ if [ " $STANDALONE_INSTALL_PREFIX " != /usr/local ]; then
110
108
cath << EOF
111
109
Extend your path to use Coder:
112
-
113
- $ PATH="$STANDALONE_INSTALL_PREFIX /bin:\$ PATH"
110
+ PATH="$STANDALONE_INSTALL_PREFIX /bin:\$ PATH"
114
111
115
112
EOF
116
- elif [ " $CODER_COMMAND " != " $STANDALONE_BINARY_LOCATION " ]; then
117
- echo_path_conflict " $CODER_COMMAND " " $STANDALONE_INSTALL_PREFIX "
118
- else
119
- cath << EOF
120
- To run a Coder server:
121
-
122
- $ $STANDALONE_BINARY_NAME server
123
-
124
- To connect to a Coder deployment:
125
-
126
- $ $STANDALONE_BINARY_NAME login <deployment url>
113
+ fi
114
+ cath << EOF
115
+ Run Coder:
116
+ $STANDALONE_BINARY_NAME server
127
117
128
118
EOF
129
- fi
130
119
}
131
120
132
121
echo_brew_postinstall () {
@@ -135,15 +124,8 @@ echo_brew_postinstall() {
135
124
return
136
125
fi
137
126
138
- CODER_COMMAND=" $( command -v " coder" ) "
139
- BREW_PREFIX=" $( brew --prefix) "
140
-
141
- if [ " $CODER_COMMAND " != " $BREW_PREFIX /bin/coder" ]; then
142
- echo_path_conflict " $CODER_COMMAND " " $BREW_PREFIX "
143
- fi
144
-
145
127
cath << EOF
146
- Homebrew formula has been installed.
128
+ brew formula has been installed.
147
129
148
130
To run a Coder server:
149
131
@@ -175,6 +157,7 @@ To run a Coder server:
175
157
# Or just run the server directly
176
158
$ coder server
177
159
160
+ Default URL: http://127.0.0.1:3000
178
161
Configuring Coder: https://coder.com/docs/v2/latest/admin/configure
179
162
180
163
To connect to a Coder deployment:
@@ -186,45 +169,28 @@ EOF
186
169
187
170
echo_dryrun_postinstall () {
188
171
cath << EOF
172
+
189
173
Dry-run complete.
190
174
191
175
To install Coder, re-run this script without the --dry-run flag.
192
-
193
- EOF
194
- }
195
-
196
- echo_path_conflict () {
197
- cath << EOF
198
- There is another binary in your PATH that conflicts with the binary we've installed.
199
-
200
- $1
201
-
202
- This is likely because of an existing installation of Coder. See our documentation for suggests on how to resolve this.
203
-
204
- https://coder.com/docs/v2/latest/install/install.sh#path-conflicts
205
-
206
176
EOF
207
177
}
208
178
209
179
main () {
210
180
TERRAFORM_VERSION=" 1.3.4"
211
-
212
181
if [ " ${TRACE-} " ]; then
213
182
set -x
214
183
fi
215
-
216
184
unset \
217
185
DRY_RUN \
218
186
METHOD \
219
187
OPTIONAL \
220
188
ALL_FLAGS \
221
189
RSH_ARGS \
222
190
EDGE \
223
- RSH \
224
- WITH_TERRAFORM
191
+ RSH
225
192
226
193
ALL_FLAGS=" "
227
-
228
194
while [ " $# " -gt 0 ]; do
229
195
case " $1 " in
230
196
-* )
@@ -279,7 +245,7 @@ main() {
279
245
exit 0
280
246
;;
281
247
--with-terraform)
282
- WITH_TERRAFORM=1
248
+ METHOD=with_terraform
283
249
;;
284
250
--)
285
251
shift
@@ -309,29 +275,8 @@ main() {
309
275
return
310
276
fi
311
277
312
- # These can be overridden for testing but shouldn't normally be used as it can
313
- # result in a broken coder.
314
- OS=${OS:- $(os)}
315
- ARCH=${ARCH:- $(arch)}
316
- TERRAFORM_ARCH=${TERRAFORM_ARCH:- $(terraform_arch)}
317
-
318
- # We can't reasonably support installing specific versions of Coder through
319
- # Homebrew, so if we're on macOS and the `--version` flag was set, we should
320
- # "detect" standalone to be the appropriate installation method. This check
321
- # needs to occur before we set `VERSION` to a default of the latest release.
322
- if [ " $OS " = " darwin" ] && [ " ${VERSION-} " ]; then
323
- METHOD=standalone
324
- fi
325
-
326
- # If we've been provided a flag which is specific to the standalone installation
327
- # method, we should "detect" standalone to be the appropriate installation method.
328
- # This check needs to occur before we set these variables with defaults.
329
- if [ " ${STANDALONE_INSTALL_PREFIX-} " ] || [ " ${STANDALONE_BINARY_NAME-} " ]; then
330
- METHOD=standalone
331
- fi
332
-
333
278
METHOD=" ${METHOD-detect} "
334
- if [ " $METHOD " != detect ] && [ " $METHOD " != standalone ]; then
279
+ if [ " $METHOD " != detect ] && [ " $METHOD " != with_terraform ] && [ " $METHOD " != standalone ]; then
335
280
echoerr " Unknown install method \" $METHOD \" "
336
281
echoerr " Run with --help to see usage."
337
282
exit 1
@@ -340,10 +285,15 @@ main() {
340
285
# These are used by the various install_* functions that make use of GitHub
341
286
# releases in order to download and unpack the right release.
342
287
CACHE_DIR=$( echo_cache_dir)
343
- TERRAFORM_INSTALL_PREFIX=${TERRAFORM_INSTALL_PREFIX:-/ usr/ local}
344
288
STANDALONE_INSTALL_PREFIX=${STANDALONE_INSTALL_PREFIX:-/ usr/ local}
289
+ TERRAFORM_INSTALL_PREFIX=${TERRAFORM_INSTALL_PREFIX:-/ usr/ local}
345
290
STANDALONE_BINARY_NAME=${STANDALONE_BINARY_NAME:- coder}
346
291
VERSION=${VERSION:- $(echo_latest_version)}
292
+ # These can be overridden for testing but shouldn't normally be used as it can
293
+ # result in a broken coder.
294
+ OS=${OS:- $(os)}
295
+ ARCH=${ARCH:- $(arch)}
296
+ TERRAFORM_ARCH=${TERRAFORM_ARCH:- $(terraform_arch)}
347
297
348
298
distro_name
349
299
@@ -352,11 +302,6 @@ main() {
352
302
echoh
353
303
fi
354
304
355
- # Start by installing Terraform, if requested
356
- if [ " ${WITH_TERRAFORM-} " = 1 ]; then
357
- with_terraform
358
- fi
359
-
360
305
# Standalone installs by pulling pre-built releases from GitHub.
361
306
if [ " $METHOD " = standalone ]; then
362
307
if has_standalone; then
@@ -368,6 +313,10 @@ main() {
368
313
exit 1
369
314
fi
370
315
fi
316
+ if [ " $METHOD " = with_terraform ]; then
317
+ # Install terraform then continue the script
318
+ with_terraform
319
+ fi
371
320
372
321
# DISTRO can be overridden for testing but shouldn't normally be used as it
373
322
# can result in a broken coder.
@@ -480,7 +429,7 @@ with_terraform() {
480
429
install_macos () {
481
430
# If there is no `brew` binary available, just default to installing standalone
482
431
if command_exists brew; then
483
- echoh " Installing coder with Homebrew from the coder/coder tap ."
432
+ echoh " Installing v $VERSION of the coder formula from coder/coder."
484
433
echoh
485
434
486
435
sh_c brew install coder/coder/coder
@@ -556,16 +505,16 @@ install_standalone() {
556
505
" $sh_c " unzip -d " $CACHE_DIR " -o " $CACHE_DIR /coder_${VERSION} _${OS} _${ARCH} .zip"
557
506
fi
558
507
559
- STANDALONE_BINARY_LOCATION =" $STANDALONE_INSTALL_PREFIX /bin/$STANDALONE_BINARY_NAME "
508
+ COPY_LOCATION =" $STANDALONE_INSTALL_PREFIX /bin/$STANDALONE_BINARY_NAME "
560
509
561
510
# Remove the file if it already exists to
562
511
# avoid https://github.com/coder/coder/issues/2086
563
- if [ -f " $STANDALONE_BINARY_LOCATION " ]; then
564
- " $sh_c " rm " $STANDALONE_BINARY_LOCATION "
512
+ if [ -f " $COPY_LOCATION " ]; then
513
+ " $sh_c " rm " $COPY_LOCATION "
565
514
fi
566
515
567
516
# Copy the binary to the correct location.
568
- " $sh_c " cp " $CACHE_DIR /coder" " $STANDALONE_BINARY_LOCATION "
517
+ " $sh_c " cp " $CACHE_DIR /coder" " $COPY_LOCATION "
569
518
570
519
echo_standalone_postinstall
571
520
}
0 commit comments