@@ -9,15 +9,15 @@ usage() {
99 if [ " $0 " = sh ]; then
1010 arg0=" curl -fsSL https://code-server.dev/install.sh | sh -s --"
1111 else
12- curl_usage =" The latest script is available at https://code-server.dev/install.sh
12+ not_curl_usage =" The latest script is available at https://code-server.dev/install.sh
1313"
1414 fi
1515
1616 cath << EOF
1717Installs code-server for Linux and macOS.
1818It tries to use the system package manager if possible.
1919After successful installation it explains how to start using code-server.
20- ${curl_usage -}
20+ ${not_curl_usage -}
2121Usage:
2222
2323 $arg0 [--dry-run] [--version X.X.X] [--method detect] [--prefix ~/.local]
@@ -286,19 +286,14 @@ install_aur() {
286286 echoh " Installing from the AUR."
287287 echoh
288288
289- tmp_dir=" $( mktemp -d) "
290-
291- echoh " + Downloading PKGBUILD into $tmp_dir from https://aur.archlinux.org/cgit/aur.git/snapshot/code-server.tar.gz"
292- curl -fsSL https://aur.archlinux.org/cgit/aur.git/snapshot/code-server.tar.gz | tar -xzC " $tmp_dir "
293- VERSION=" $( . " $tmp_dir /code-server/PKGBUILD" && echo " $pkgver " ) "
294-
295- sh_c mkdir -p " $CACHE_DIR /code-server-$VERSION -aur"
296- sh_c cp -a " $tmp_dir /code-server/*" " $CACHE_DIR /code-server-$VERSION -aur"
297- sh_c cd " $CACHE_DIR /code-server-$VERSION -aur"
289+ sh_c mkdir -p " $CACHE_DIR /code-server-aur"
290+ 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"
291+ echo " + cd $CACHE_DIR /code-server-aur"
292+ if [ ! " ${DRY_RUN-} " ]; then
293+ cd " $CACHE_DIR /code-server-aur"
294+ fi
298295 sh_c makepkg -si
299296
300- rm -R " $tmp_dir "
301-
302297 echo_systemd_postinstall
303298}
304299
@@ -478,9 +473,10 @@ echoerr() {
478473 echoh " $@ " >&2
479474}
480475
481- # humanpath replaces all occurances of $HOME with ~
476+ # humanpath replaces all occurances of " $HOME" with " ~"
477+ # and all occurances of '"$HOME' with the literal '"$HOME'.
482478humanpath () {
483- sed " s#$HOME #~ #g"
479+ sed " s# $HOME # ~#g; s# \" $HOME # \"\$ HOME #g"
484480}
485481
486482main " $@ "
0 commit comments