@@ -156,12 +156,12 @@ main() {
156156 echoerr " Run with --help to see usage."
157157 exit 1
158158 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} "
161161
162162 OS=" $( os) "
163163 if [ ! " $OS " ]; then
164- echoerr " Unsupported OS $( uname) ."
164+ echoerr " Unsupported OS $( sh_f uname) ."
165165 exit 1
166166 fi
167167
@@ -170,11 +170,11 @@ main() {
170170 ARCH=" $( arch) "
171171 if [ ! " $ARCH " ]; then
172172 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) ."
174174 echoerr ' Please rerun without the "--method standalone" flag to install from npm.'
175175 exit 1
176176 fi
177- echoh " No precompiled releases for $( sh_c_f uname -m) ."
177+ echoh " No precompiled releases for $( sh_f uname -m) ."
178178 install_npm
179179 return
180180 fi
@@ -311,7 +311,7 @@ install_aur() {
311311 sh_c mkdir -p " $CACHE_DIR /code-server-aur"
312312 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"
313313 echo " + cd $CACHE_DIR /code-server-aur"
314- if [ ! " ${DRY_RUN-} " ]; then
314+ if sh_f [ ! " ${DRY_RUN-} " ]; then
315315 cd " $CACHE_DIR /code-server-aur"
316316 fi
317317 sh_c makepkg -si
@@ -327,11 +327,11 @@ install_standalone() {
327327 " $CACHE_DIR /code-server-$VERSION -$OS -$ARCH .tar.gz"
328328
329329 sh_c=" sh_c"
330- if [ ! -w " $STANDALONE_INSTALL_PREFIX " ]; then
330+ if sh-f [ ! -w " $STANDALONE_INSTALL_PREFIX " ]; then
331331 sh_c=" sudo_sh_c"
332332 fi
333333
334- if [ -e " $STANDALONE_INSTALL_PREFIX /lib/code-server-$VERSION " ]; then
334+ if sh_f [ -e " $STANDALONE_INSTALL_PREFIX /lib/code-server-$VERSION " ]; then
335335 echoh
336336 echoh " code-server-$VERSION is already installed at $STANDALONE_INSTALL_PREFIX /lib/code-server-$VERSION "
337337 echoh " Remove it to reinstall."
@@ -349,7 +349,7 @@ install_standalone() {
349349install_npm () {
350350 if command_exists yarn; then
351351 sh_c=" sh_c"
352- if [ ! -w " $( yarn global bin) " ]; then
352+ if sh_f [ ! -w " $( sh_f yarn global bin) " ]; then
353353 sh_c=" sudo_sh_c"
354354 fi
355355 echoh " Installing with yarn."
@@ -358,7 +358,7 @@ install_npm() {
358358 return
359359 elif command_exists npm; then
360360 sh_c=" sh_c"
361- if [ ! -w " $( npm config get prefix) " ]; then
361+ if sh_f [ ! -w " $( sh_f npm config get prefix) " ]; then
362362 sh_c=" sudo_sh_c"
363363 fi
364364 echoh " Installing with npm."
@@ -374,7 +374,7 @@ install_npm() {
374374}
375375
376376os () {
377- case " $( sh_c_f uname) " in
377+ case " $( sh_f uname) " in
378378 Linux)
379379 echo linux
380380 ;;
@@ -399,15 +399,14 @@ os() {
399399#
400400# Inspired by https://github.com/docker/docker-install/blob/26ff363bcf3b3f5a00498ac43694bf1c7d9ce16c/install.sh#L111-L120.
401401distro () {
402- set -x
403402 if [ " $OS " = " macos" ] || [ " $OS " = " freebsd" ]; then
404403 echo " $OS "
405404 return
406405 fi
407406
408- if sh_c_f [ -f /etc/os-release ]; then
407+ if sh_f [ -f /etc/os-release ]; then
409408 (
410- ID=" $( sh_c_f ' . /etc/os-release && echo "$ID"' ) "
409+ ID=" $( sh_f ' . /etc/os-release && echo "$ID"' ) "
411410 case " $ID " in opensuse-* )
412411 # opensuse's ID's look like opensuse-leap and opensuse-tumbleweed.
413412 echo " opensuse"
@@ -423,22 +422,22 @@ distro() {
423422
424423# os_name prints a pretty human readable name for the OS/Distro.
425424distro_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) "
428427 return
429428 fi
430429
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"'
433432 return
434433 fi
435434
436435 # Prints something like: Linux 4.19.0-9-amd64
437- sh_c_f uname -sr
436+ sh_f uname -sr
438437}
439438
440439arch () {
441- case " $( sh_c_f uname -m) " in
440+ case " $( sh_f uname -m) " in
442441 aarch64)
443442 echo arm64
444443 ;;
@@ -452,18 +451,18 @@ arch() {
452451}
453452
454453command_exists () {
455- command -v " $@ " > /dev/null 2>&1
454+ sh_f command -v " $@ " > /dev/null
456455}
457456
458457sh_c () {
459458 echoh " + $* "
460459 if [ ! " ${DRY_RUN-} " ]; then
461- sh_c_f " $@ "
460+ sh_f " $@ "
462461 fi
463462}
464463
465464# Always runs.
466- sh_c_f () {
465+ sh_f () {
467466 if [ " $SSH_ARGS " ]; then
468467 mkdir -p ~ /.ssh/sockets
469468 ssh \
@@ -477,7 +476,7 @@ sh_c_f() {
477476}
478477
479478sudo_sh_c () {
480- if [ " $( id -u) " = 0 ]; then
479+ if [ " $( sh_f id -u) " = 0 ]; then
481480 sh_c " $@ "
482481 elif command_exists sudo; then
483482 sh_c " sudo $* "
@@ -493,8 +492,8 @@ sudo_sh_c() {
493492}
494493
495494echo_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"
498497 elif [ " ${RHOME-} " ]; then
499498 echo " $RHOME /.cache/code-server"
500499 else
0 commit comments