@@ -156,12 +156,12 @@ main() {
156
156
echoerr " Run with --help to see usage."
157
157
exit 1
158
158
fi
159
- RHOME=" $( sh_c_f printenv HOME) "
160
- STANDALONE_INSTALL_PREFIX=" ${STANDALONE_INSTALL_PREFIX-$HOME / .local} "
159
+ RHOME=" $( sh_f printenv HOME) "
160
+ STANDALONE_INSTALL_PREFIX=" ${STANDALONE_INSTALL_PREFIX-$RHOME / .local} "
161
161
162
162
OS=" $( os) "
163
163
if [ ! " $OS " ]; then
164
- echoerr " Unsupported OS $( uname) ."
164
+ echoerr " Unsupported OS $( sh_f uname) ."
165
165
exit 1
166
166
fi
167
167
@@ -170,11 +170,11 @@ main() {
170
170
ARCH=" $( arch) "
171
171
if [ ! " $ARCH " ]; then
172
172
if [ " $METHOD " = standalone ]; then
173
- echoerr " No precompiled releases for $( sh_c_f uname -m) ."
173
+ echoerr " No precompiled releases for $( sh_f uname -m) ."
174
174
echoerr ' Please rerun without the "--method standalone" flag to install from npm.'
175
175
exit 1
176
176
fi
177
- echoh " No precompiled releases for $( sh_c_f uname -m) ."
177
+ echoh " No precompiled releases for $( sh_f uname -m) ."
178
178
install_npm
179
179
return
180
180
fi
@@ -311,7 +311,7 @@ install_aur() {
311
311
sh_c mkdir -p " $CACHE_DIR /code-server-aur"
312
312
sh_c " curl -#fsSL https://aur.archlinux.org/cgit/aur.git/snapshot/code-server.tar.gz | tar -xzC $CACHE_DIR /code-server-aur --strip-components 1"
313
313
echo " + cd $CACHE_DIR /code-server-aur"
314
- if [ ! " ${DRY_RUN-} " ]; then
314
+ if sh_f [ ! " ${DRY_RUN-} " ]; then
315
315
cd " $CACHE_DIR /code-server-aur"
316
316
fi
317
317
sh_c makepkg -si
@@ -327,11 +327,11 @@ install_standalone() {
327
327
" $CACHE_DIR /code-server-$VERSION -$OS -$ARCH .tar.gz"
328
328
329
329
sh_c=" sh_c"
330
- if [ ! -w " $STANDALONE_INSTALL_PREFIX " ]; then
330
+ if sh-f [ ! -w " $STANDALONE_INSTALL_PREFIX " ]; then
331
331
sh_c=" sudo_sh_c"
332
332
fi
333
333
334
- if [ -e " $STANDALONE_INSTALL_PREFIX /lib/code-server-$VERSION " ]; then
334
+ if sh_f [ -e " $STANDALONE_INSTALL_PREFIX /lib/code-server-$VERSION " ]; then
335
335
echoh
336
336
echoh " code-server-$VERSION is already installed at $STANDALONE_INSTALL_PREFIX /lib/code-server-$VERSION "
337
337
echoh " Remove it to reinstall."
@@ -349,7 +349,7 @@ install_standalone() {
349
349
install_npm () {
350
350
if command_exists yarn; then
351
351
sh_c=" sh_c"
352
- if [ ! -w " $( yarn global bin) " ]; then
352
+ if sh_f [ ! -w " $( sh_f yarn global bin) " ]; then
353
353
sh_c=" sudo_sh_c"
354
354
fi
355
355
echoh " Installing with yarn."
@@ -358,7 +358,7 @@ install_npm() {
358
358
return
359
359
elif command_exists npm; then
360
360
sh_c=" sh_c"
361
- if [ ! -w " $( npm config get prefix) " ]; then
361
+ if sh_f [ ! -w " $( sh_f npm config get prefix) " ]; then
362
362
sh_c=" sudo_sh_c"
363
363
fi
364
364
echoh " Installing with npm."
@@ -374,7 +374,7 @@ install_npm() {
374
374
}
375
375
376
376
os () {
377
- case " $( sh_c_f uname) " in
377
+ case " $( sh_f uname) " in
378
378
Linux)
379
379
echo linux
380
380
;;
@@ -399,15 +399,14 @@ os() {
399
399
#
400
400
# Inspired by https://github.com/docker/docker-install/blob/26ff363bcf3b3f5a00498ac43694bf1c7d9ce16c/install.sh#L111-L120.
401
401
distro () {
402
- set -x
403
402
if [ " $OS " = " macos" ] || [ " $OS " = " freebsd" ]; then
404
403
echo " $OS "
405
404
return
406
405
fi
407
406
408
- if sh_c_f [ -f /etc/os-release ]; then
407
+ if sh_f [ -f /etc/os-release ]; then
409
408
(
410
- ID=" $( sh_c_f ' . /etc/os-release && echo "$ID"' ) "
409
+ ID=" $( sh_f ' . /etc/os-release && echo "$ID"' ) "
411
410
case " $ID " in opensuse-* )
412
411
# opensuse's ID's look like opensuse-leap and opensuse-tumbleweed.
413
412
echo " opensuse"
@@ -423,22 +422,22 @@ distro() {
423
422
424
423
# os_name prints a pretty human readable name for the OS/Distro.
425
424
distro_name () {
426
- if [ " $( sh_c_f uname) " = " Darwin" ]; then
427
- echo " macOS v$( sh_c_f sw_vers -productVersion) "
425
+ if [ " $( sh_f uname) " = " Darwin" ]; then
426
+ echo " macOS v$( sh_f sw_vers -productVersion) "
428
427
return
429
428
fi
430
429
431
- if sh_c_f [ -f /etc/os-release ]; then
432
- sh_c_f ' . /etc/os-release && echo "$PRETTY_NAME"'
430
+ if sh_f [ -f /etc/os-release ]; then
431
+ sh_f ' . /etc/os-release && echo "$PRETTY_NAME"'
433
432
return
434
433
fi
435
434
436
435
# Prints something like: Linux 4.19.0-9-amd64
437
- sh_c_f uname -sr
436
+ sh_f uname -sr
438
437
}
439
438
440
439
arch () {
441
- case " $( sh_c_f uname -m) " in
440
+ case " $( sh_f uname -m) " in
442
441
aarch64)
443
442
echo arm64
444
443
;;
@@ -452,18 +451,18 @@ arch() {
452
451
}
453
452
454
453
command_exists () {
455
- command -v " $@ " > /dev/null 2>&1
454
+ sh_f command -v " $@ " > /dev/null
456
455
}
457
456
458
457
sh_c () {
459
458
echoh " + $* "
460
459
if [ ! " ${DRY_RUN-} " ]; then
461
- sh_c_f " $@ "
460
+ sh_f " $@ "
462
461
fi
463
462
}
464
463
465
464
# Always runs.
466
- sh_c_f () {
465
+ sh_f () {
467
466
if [ " $SSH_ARGS " ]; then
468
467
mkdir -p ~ /.ssh/sockets
469
468
ssh \
@@ -477,7 +476,7 @@ sh_c_f() {
477
476
}
478
477
479
478
sudo_sh_c () {
480
- if [ " $( id -u) " = 0 ]; then
479
+ if [ " $( sh_f id -u) " = 0 ]; then
481
480
sh_c " $@ "
482
481
elif command_exists sudo; then
483
482
sh_c " sudo $* "
@@ -493,8 +492,8 @@ sudo_sh_c() {
493
492
}
494
493
495
494
echo_cache_dir () {
496
- if [ " $( sh_c_f printenv XDG_CACHE_HOME) " ]; then
497
- echo " $( sh_c_f printenv XDG_CACHE_HOME) /code-server"
495
+ if [ " $( sh_f printenv XDG_CACHE_HOME) " ]; then
496
+ echo " $( sh_f printenv XDG_CACHE_HOME) /code-server"
498
497
elif [ " ${RHOME-} " ]; then
499
498
echo " $RHOME /.cache/code-server"
500
499
else
0 commit comments