@@ -12,7 +12,7 @@ usage() {
12
12
"
13
13
fi
14
14
15
- cath << EOF
15
+ cath << EOF
16
16
Installs Coder.
17
17
It tries to use the system package manager if possible.
18
18
After successful installation it explains how to start Coder.
@@ -82,7 +82,7 @@ echo_latest_version() {
82
82
echo_standalone_postinstall () {
83
83
echoh
84
84
cath << EOF
85
- Standalone release has been installed into $STANDALONE_INSTALL_PREFIX /bin/coder
85
+ Standalone release has been installed into $STANDALONE_INSTALL_PREFIX /bin/coder
86
86
87
87
Extend your path to use Coder:
88
88
PATH="$STANDALONE_INSTALL_PREFIX /bin:\$ PATH"
@@ -133,66 +133,66 @@ main() {
133
133
ALL_FLAGS=" "
134
134
while [ " $# " -gt 0 ]; do
135
135
case " $1 " in
136
- -* )
137
- ALL_FLAGS=" ${ALL_FLAGS} $1 "
138
- ;;
136
+ -* )
137
+ ALL_FLAGS=" ${ALL_FLAGS} $1 "
138
+ ;;
139
139
esac
140
140
141
141
case " $1 " in
142
- --dry-run)
143
- DRY_RUN=1
144
- ;;
145
- --method)
146
- METHOD=" $( parse_arg " $@ " ) "
147
- shift
148
- ;;
149
- --method=* )
150
- METHOD=" $( parse_arg " $@ " ) "
151
- ;;
152
- --prefix)
153
- STANDALONE_INSTALL_PREFIX=" $( parse_arg " $@ " ) "
154
- shift
155
- ;;
156
- --prefix=* )
157
- STANDALONE_INSTALL_PREFIX=" $( parse_arg " $@ " ) "
158
- ;;
159
- --version)
160
- VERSION=" $( parse_arg " $@ " ) "
161
- shift
162
- ;;
163
- --version=* )
164
- VERSION=" $( parse_arg " $@ " ) "
165
- ;;
166
- --edge)
167
- EDGE=1
168
- ;;
169
- --rsh)
170
- RSH=" $( parse_arg " $@ " ) "
171
- shift
172
- ;;
173
- --rsh=* )
174
- RSH=" $( parse_arg " $@ " ) "
175
- ;;
176
- -h | --h | -help | --help)
177
- usage
178
- exit 0
179
- ;;
180
- --)
181
- shift
182
- # We remove the -- added above.
183
- ALL_FLAGS=" ${ALL_FLAGS% --} "
184
- RSH_ARGS=" $* "
185
- break
186
- ;;
187
- -* )
188
- echoerr " Unknown flag $1 "
189
- echoerr " Run with --help to see usage."
190
- exit 1
191
- ;;
192
- * )
193
- RSH_ARGS=" $* "
194
- break
195
- ;;
142
+ --dry-run)
143
+ DRY_RUN=1
144
+ ;;
145
+ --method)
146
+ METHOD=" $( parse_arg " $@ " ) "
147
+ shift
148
+ ;;
149
+ --method=* )
150
+ METHOD=" $( parse_arg " $@ " ) "
151
+ ;;
152
+ --prefix)
153
+ STANDALONE_INSTALL_PREFIX=" $( parse_arg " $@ " ) "
154
+ shift
155
+ ;;
156
+ --prefix=* )
157
+ STANDALONE_INSTALL_PREFIX=" $( parse_arg " $@ " ) "
158
+ ;;
159
+ --version)
160
+ VERSION=" $( parse_arg " $@ " ) "
161
+ shift
162
+ ;;
163
+ --version=* )
164
+ VERSION=" $( parse_arg " $@ " ) "
165
+ ;;
166
+ --edge)
167
+ EDGE=1
168
+ ;;
169
+ --rsh)
170
+ RSH=" $( parse_arg " $@ " ) "
171
+ shift
172
+ ;;
173
+ --rsh=* )
174
+ RSH=" $( parse_arg " $@ " ) "
175
+ ;;
176
+ -h | --h | -help | --help)
177
+ usage
178
+ exit 0
179
+ ;;
180
+ --)
181
+ shift
182
+ # We remove the -- added above.
183
+ ALL_FLAGS=" ${ALL_FLAGS% --} "
184
+ RSH_ARGS=" $* "
185
+ break
186
+ ;;
187
+ -* )
188
+ echoerr " Unknown flag $1 "
189
+ echoerr " Run with --help to see usage."
190
+ exit 1
191
+ ;;
192
+ * )
193
+ RSH_ARGS=" $* "
194
+ break
195
+ ;;
196
196
esac
197
197
198
198
shift
@@ -241,54 +241,54 @@ main() {
241
241
DISTRO=${DISTRO:- $(distro)}
242
242
243
243
case $DISTRO in
244
- # macOS uses the standalone installation for now.
245
- # Homebrew support is planned. See: https://github.com/coder/coder/issues/1925
246
- macos) install_standalone ;;
247
- # The .deb and .rpm files are pulled from GitHub.
248
- debian) install_deb ;;
249
- fedora | opensuse) install_rpm ;;
250
- # We don't have GitHub releases that work on Alpine or FreeBSD so we have no
251
- # choice but to use npm here.
252
- alpine) install_apk ;;
253
- # For anything else we'll try to install standalone but fall back to npm if
254
- # we don't have releases for the architecture.
255
- * )
256
- echoh " Unsupported package manager."
257
- echoh " Falling back to standalone installation."
258
- install_standalone
259
- ;;
244
+ # macOS uses the standalone installation for now.
245
+ # Homebrew support is planned. See: https://github.com/coder/coder/issues/1925
246
+ macos) install_standalone ;;
247
+ # The .deb and .rpm files are pulled from GitHub.
248
+ debian) install_deb ;;
249
+ fedora | opensuse) install_rpm ;;
250
+ # We don't have GitHub releases that work on Alpine or FreeBSD so we have no
251
+ # choice but to use npm here.
252
+ alpine) install_apk ;;
253
+ # For anything else we'll try to install standalone but fall back to npm if
254
+ # we don't have releases for the architecture.
255
+ * )
256
+ echoh " Unsupported package manager."
257
+ echoh " Falling back to standalone installation."
258
+ install_standalone
259
+ ;;
260
260
esac
261
261
}
262
262
263
263
parse_arg () {
264
264
case " $1 " in
265
- * =* )
266
- # Remove everything after first equal sign.
267
- opt=" ${1%% =* } "
268
- # Remove everything before first equal sign.
269
- optarg=" ${1#* =} "
270
- if [ ! " $optarg " ] && [ ! " ${OPTIONAL-} " ]; then
271
- echoerr " $opt requires an argument"
272
- echoerr " Run with --help to see usage."
273
- exit 1
274
- fi
275
- echo " $optarg "
276
- return
277
- ;;
265
+ * =* )
266
+ # Remove everything after first equal sign.
267
+ opt=" ${1%% =* } "
268
+ # Remove everything before first equal sign.
269
+ optarg=" ${1#* =} "
270
+ if [ ! " $optarg " ] && [ ! " ${OPTIONAL-} " ]; then
271
+ echoerr " $opt requires an argument"
272
+ echoerr " Run with --help to see usage."
273
+ exit 1
274
+ fi
275
+ echo " $optarg "
276
+ return
277
+ ;;
278
278
esac
279
279
280
280
case " ${2-} " in
281
- " " | -* )
282
- if [ ! " ${OPTIONAL-} " ]; then
283
- echoerr " $1 requires an argument"
284
- echoerr " Run with --help to see usage."
285
- exit 1
286
- fi
287
- ;;
288
- * )
289
- echo " $2 "
290
- return
291
- ;;
281
+ " " | -* )
282
+ if [ ! " ${OPTIONAL-} " ]; then
283
+ echoerr " $1 requires an argument"
284
+ echoerr " Run with --help to see usage."
285
+ exit 1
286
+ fi
287
+ ;;
288
+ * )
289
+ echo " $2 "
290
+ return
291
+ ;;
292
292
esac
293
293
}
294
294
@@ -359,7 +359,7 @@ install_standalone() {
359
359
360
360
# -w only works if the directory exists so try creating it first. If this
361
361
# fails we can ignore the error as the -w check will then swap us to sudo.
362
- sh_c mkdir -p " $STANDALONE_INSTALL_PREFIX " 2> /dev/null || true
362
+ sh_c mkdir -p " $STANDALONE_INSTALL_PREFIX " 2> /dev/null || true
363
363
364
364
sh_c=" sh_c"
365
365
if [ ! -w " $STANDALONE_INSTALL_PREFIX " ]; then
@@ -382,23 +382,23 @@ install_standalone() {
382
382
# TODO: fix for Coder v2
383
383
has_standalone () {
384
384
case $ARCH in
385
- amd64) return 0 ;;
386
- # We only have amd64 for macOS.
387
- arm64)
388
- [ " $( distro) " != darwin ]
389
- return
390
- ;;
391
- * ) return 1 ;;
385
+ amd64) return 0 ;;
386
+ # We only have amd64 for macOS.
387
+ arm64)
388
+ [ " $( distro) " != darwin ]
389
+ return
390
+ ;;
391
+ * ) return 1 ;;
392
392
esac
393
393
}
394
394
395
395
os () {
396
396
uname=" $( uname) "
397
397
case $uname in
398
- Linux) echo linux ;;
399
- Darwin) echo darwin ;;
400
- FreeBSD) echo freebsd ;;
401
- * ) echo " $uname " ;;
398
+ Linux) echo linux ;;
399
+ Darwin) echo darwin ;;
400
+ FreeBSD) echo freebsd ;;
401
+ * ) echo " $uname " ;;
402
402
esac
403
403
}
404
404
@@ -461,15 +461,15 @@ distro_name() {
461
461
arch () {
462
462
uname_m=$( uname -m)
463
463
case $uname_m in
464
- aarch64) echo arm64 ;;
465
- x86_64) echo amd64 ;;
466
- * ) echo " $uname_m " ;;
464
+ aarch64) echo arm64 ;;
465
+ x86_64) echo amd64 ;;
466
+ * ) echo " $uname_m " ;;
467
467
esac
468
468
}
469
469
470
470
command_exists () {
471
471
if [ ! " $1 " ]; then return 1; fi
472
- command -v " $@ " > /dev/null
472
+ command -v " $@ " > /dev/null
473
473
}
474
474
475
475
sh_c () {
@@ -531,7 +531,7 @@ prefix() {
531
531
fifo=" $( mktemp -d) /fifo"
532
532
mkfifo " $fifo "
533
533
sed -e " s#^#$PREFIX : #" " $fifo " &
534
- " $@ " > " $fifo " 2>&1
534
+ " $@ " > " $fifo " 2>&1
535
535
}
536
536
537
537
main " $@ "
0 commit comments