@@ -13,7 +13,7 @@ usage() {
13
13
"
14
14
fi
15
15
16
- cat << EOF
16
+ cath << EOF
17
17
Installs code-server for Linux and macOS.
18
18
It tries to use the system package manager if possible.
19
19
After successful installation it explains how to start using code-server.
@@ -67,8 +67,8 @@ echo_latest_version() {
67
67
}
68
68
69
69
echo_standalone_postinstall () {
70
- echo
71
- cat << EOF
70
+ echoh
71
+ cath << EOF
72
72
Standalone release has been installed into $STANDALONE_INSTALL_PREFIX /lib/code-server-$VERSION
73
73
Please extend your path to use code-server:
74
74
PATH="$STANDALONE_INSTALL_PREFIX /bin:\$ PATH"
78
78
}
79
79
80
80
echo_systemd_postinstall () {
81
- echo
82
- cat << EOF
81
+ echoh
82
+ cath << EOF
83
83
To have systemd start code-server now and restart on boot:
84
84
systemctl --user enable --now code-server
85
85
Or, if you don't want/need a background service you can run:
@@ -163,7 +163,7 @@ main() {
163
163
echoerr ' Please rerun without the "--method standalone" flag to install from npm.'
164
164
exit 1
165
165
fi
166
- echo " No precompiled releases for $( uname -m) ."
166
+ echoh " No precompiled releases for $( uname -m) ."
167
167
install_npm
168
168
return
169
169
fi
@@ -190,7 +190,7 @@ main() {
190
190
install_aur
191
191
;;
192
192
* )
193
- echo " Unsupported package manager."
193
+ echoh " Unsupported package manager."
194
194
install_standalone
195
195
;;
196
196
esac
@@ -233,7 +233,7 @@ fetch() {
233
233
FILE=" $2 "
234
234
235
235
if [ -e " $FILE " ]; then
236
- echo " + Reusing $CACHE_DIR /${URL##*/ } "
236
+ echoh " + Reusing $CACHE_DIR /${URL##*/ } "
237
237
return
238
238
fi
239
239
@@ -247,22 +247,22 @@ fetch() {
247
247
248
248
install_macos () {
249
249
if command_exists brew; then
250
- echo " Installing from Homebrew."
251
- echo
250
+ echoh " Installing from Homebrew."
251
+ echoh
252
252
253
253
sh_c brew install code-server
254
254
255
255
return
256
256
fi
257
257
258
- echo " Homebrew not installed."
258
+ echoh " Homebrew not installed."
259
259
260
260
install_standalone
261
261
}
262
262
263
263
install_deb () {
264
- echo " Installing v$VERSION deb package from GitHub releases."
265
- echo
264
+ echoh " Installing v$VERSION deb package from GitHub releases."
265
+ echoh
266
266
267
267
fetch " https://github.com/cdr/code-server/releases/download/v$VERSION /code-server_${VERSION} _$ARCH .deb" \
268
268
" $CACHE_DIR /code-server_${VERSION} _$ARCH .deb"
@@ -272,8 +272,8 @@ install_deb() {
272
272
}
273
273
274
274
install_rpm () {
275
- echo " Installing v$VERSION rpm package from GitHub releases."
276
- echo
275
+ echoh " Installing v$VERSION rpm package from GitHub releases."
276
+ echoh
277
277
278
278
fetch " https://github.com/cdr/code-server/releases/download/v$VERSION /code-server-$VERSION -$ARCH .rpm" \
279
279
" $CACHE_DIR /code-server-$VERSION -$ARCH .rpm"
@@ -283,27 +283,28 @@ install_rpm() {
283
283
}
284
284
285
285
install_aur () {
286
- echo " Installing from the AUR."
287
- echo
286
+ echoh " Installing from the AUR."
287
+ echoh
288
288
289
289
tmp_dir=" $( mktemp -d) "
290
290
291
- echo " + Downloading PKGBUILD into $tmp_dir from https://aur.archlinux.org/cgit/aur.git/snapshot/code-server.tar.gz"
291
+ echoh " + Downloading PKGBUILD into $tmp_dir from https://aur.archlinux.org/cgit/aur.git/snapshot/code-server.tar.gz"
292
292
curl -fsSL https://aur.archlinux.org/cgit/aur.git/snapshot/code-server.tar.gz | tar -xzC " $tmp_dir "
293
293
VERSION=" $( . " $tmp_dir /code-server/PKGBUILD" && echo " $pkgver " ) "
294
- rm -R " $tmp_dir "
295
294
296
295
sh_c mkdir -p " $CACHE_DIR /code-server-$VERSION -aur"
297
296
sh_c cp -a " $tmp_dir /code-server/*" " $CACHE_DIR /code-server-$VERSION -aur"
298
297
sh_c cd " $CACHE_DIR /code-server-$VERSION -aur"
299
298
sh_c makepkg -si
300
299
300
+ rm -R " $tmp_dir "
301
+
301
302
echo_systemd_postinstall
302
303
}
303
304
304
305
install_standalone () {
305
- echo " Installing standalone release archive v$VERSION "
306
- echo
306
+ echoh " Installing standalone release archive v$VERSION "
307
+ echoh
307
308
308
309
fetch " https://github.com/cdr/code-server/releases/download/v$VERSION /code-server-$VERSION -$OS -$ARCH .tar.gz" \
309
310
" $CACHE_DIR /code-server-$VERSION -$OS -$ARCH .tar.gz"
@@ -314,9 +315,9 @@ install_standalone() {
314
315
fi
315
316
316
317
if [ -e " $STANDALONE_INSTALL_PREFIX /lib/code-server-$VERSION " ]; then
317
- echo
318
- echo " code-server-$VERSION is already installed at $STANDALONE_INSTALL_PREFIX /lib/code-server-$VERSION "
319
- echo " Remove it to reinstall."
318
+ echoh
319
+ echoh " code-server-$VERSION is already installed at $STANDALONE_INSTALL_PREFIX /lib/code-server-$VERSION "
320
+ echoh " Remove it to reinstall."
320
321
exit 0
321
322
fi
322
323
@@ -334,21 +335,21 @@ install_npm() {
334
335
if [ ! -w " $( yarn global bin) " ]; then
335
336
sh_c=" sudo_sh_c"
336
337
fi
337
- echo " Installing with yarn."
338
- echo
338
+ echoh " Installing with yarn."
339
+ echoh
339
340
" $sh_c " yarn global add code-server --unsafe-perm
340
341
return
341
342
elif command_exists npm; then
342
343
sh_c=" sh_c"
343
344
if [ ! -w " $( npm config get prefix) " ]; then
344
345
sh_c=" sudo_sh_c"
345
346
fi
346
- echo " Installing with npm."
347
- echo
347
+ echoh " Installing with npm."
348
+ echoh
348
349
" $sh_c " npm install -g code-server --unsafe-perm
349
350
return
350
351
fi
351
- echo
352
+ echoh
352
353
echoerr " Please install npm or yarn to install code-server!"
353
354
echoerr " You will need at least node v12 and a few C dependencies."
354
355
echoerr " See the docs https://github.com/cdr/code-server#yarn-npm"
@@ -433,7 +434,7 @@ command_exists() {
433
434
}
434
435
435
436
sh_c () {
436
- echo " + $* "
437
+ echoh " + $* "
437
438
if [ ! " ${DRY_RUN-} " ]; then
438
439
sh -c " $* "
439
440
fi
@@ -447,7 +448,7 @@ sudo_sh_c() {
447
448
elif command_exists su; then
448
449
sh_c " su -c '$* '"
449
450
else
450
- echo
451
+ echoh
451
452
echoerr " This script needs to run the following command as root."
452
453
echoerr " $* "
453
454
echoerr " Please install sudo or su."
@@ -465,16 +466,16 @@ echo_cache_dir() {
465
466
fi
466
467
}
467
468
468
- echo () {
469
- builtin echo " $@ " | humanpath
469
+ echoh () {
470
+ echo " $@ " | humanpath
470
471
}
471
472
472
- cat () {
473
+ cath () {
473
474
humanpath
474
475
}
475
476
476
477
echoerr () {
477
- echo " $@ " >&2
478
+ echoh " $@ " >&2
478
479
}
479
480
480
481
# humanpath replaces all occurances of $HOME with ~
0 commit comments