Skip to content

Commit aa26802

Browse files
author
udhos
committed
Check /etc/profile.d instead of checking OS.
1 parent 4b7d70b commit aa26802

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

update-golang.sh

+6-9
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,16 @@ release_list=https://golang.org/dl/
3131
source=https://storage.googleapis.com/golang
3232
destination=/usr/local
3333
release=1.11.3 ;# just the default. the script detects the latest available release.
34-
profiled=/etc/profile.d/golang_path.sh
3534
arch_probe="uname -m"
3635

3736
os=$(uname -s | tr "[:upper:]" "[:lower:]")
3837

38+
if [ -d /etc/profile.d ]; then
39+
profiled=/etc/profile.d/golang_path.sh
40+
else
41+
profiled=/etc/profile
42+
fi
43+
3944
[ -n "$ARCH_PROBE" ] && arch_probe="$ARCH_PROBE"
4045

4146
arch=$($arch_probe)
@@ -107,14 +112,6 @@ fi
107112
[ -n "$ARCH" ] && arch=$ARCH
108113
cache=$destination
109114
[ -n "$CACHE" ] && cache=$CACHE
110-
111-
case "$os" in
112-
darwin)
113-
# darwin does not support /etc/profile.d, change default to /etc/profile
114-
profiled=/etc/profile
115-
;;
116-
esac
117-
118115
[ -n "$PROFILED" ] && profiled=$PROFILED
119116

120117
show_vars() {

update-golang.sh.sha256

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
544deb84b6d068470af08f06f41b262c405d8404f9f5db8e126e42ccdbc59825 update-golang.sh
1+
b93ac25f21d7bb7e7756b7344382802da8801cb4b2cfc26fc32dc2f295b01296 update-golang.sh

0 commit comments

Comments
 (0)