Skip to content

Commit 81d129b

Browse files
committed
Installs to ~/.local on linux
1 parent 936552c commit 81d129b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

install_helper.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/usr/bin/env bash
2-
set -e
2+
set -euo pipefail
33

44
get_releases() {
55
curl --silent "https://api.github.com/repos/cdr/code-server/releases/latest" |
66
grep '"browser_download_url":\|"tag_name":'
77
}
88

99
linux_install() {
10-
bin_path=$HOME/bin
11-
lib_path=$HOME/lib
10+
bin_path=$HOME/.local/bin
11+
lib_path=$HOME/.local/lib
1212

1313
releases=$(get_releases)
1414
package=$(echo "$releases" | grep 'linux' | grep 'x86' | sed -E 's/.*"([^"]+)".*/\1/')
@@ -49,8 +49,11 @@ linux_install() {
4949

5050
rm -rf -f $temp_path
5151

52+
if [ $bin_path != *"$PATH"* ]; then
53+
echo "-- WARNING: ~/.local/bin is not in your \$PATH"
54+
fi
55+
5256
echo "-- Successfully installed code-server at $bin_path/code-server"
53-
echo "-- Ensure that $bin_path is present in your \$PATH"
5457
}
5558

5659
mac_install() {
@@ -92,7 +95,6 @@ mac_install() {
9295
rm -rf -f $temp_path
9396

9497
echo "-- Successfully installed code-server at $bin_path/code-server"
95-
9698
}
9799

98100
if [[ $OSTYPE == "linux-gnu" ]]; then
@@ -101,4 +103,5 @@ elif [[ $OSTYPE == "darwin"* ]]; then
101103
mac_install
102104
else
103105
echo "Unknown operating system. Not installing."
106+
exit 1
104107
fi

0 commit comments

Comments
 (0)