Skip to content

Commit ec34412

Browse files
committed
set permissions on $abs_profiled and shellcheck config
- [x] don't assume system umask will create a readable /etc/profile.d/golang_path.sh - [x] fix typo in $dont_edit - [x] use shellcheck disable directives directly inside `update-golang.sh`
1 parent 333eaa9 commit ec34412

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

update-golang.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#
77
# PIPETHIS_AUTHOR udhos
88

9+
# ignore runtime environment variables
10+
# shellcheck disable=SC2153
911
version=0.20
1012

1113
set -o pipefail
@@ -272,19 +274,21 @@ profile_path_add() {
272274
profile_path_remove
273275

274276
msg profile_path_add: issuing new "$abs_gobin" to "$abs_profiled"
275-
local dont_edit=";# DOT NOT EDIT: installed by $path_mark"
277+
local dont_edit=";# DO NOT EDIT: installed by $path_mark"
276278
echo "export PATH=\$PATH:$abs_gobin $dont_edit" >> "$abs_profiled"
277279

278280
local user_gobin=
279281
[ -n "$GOPATH" ] && user_gobin=$(echo "$GOPATH" | awk -F: '{print $1}')/bin
280-
[ -z "$user_gobin" ] && user_gobin='$HOME/go/bin'
282+
# shellcheck disable=SC2016
283+
[ -z "$user_gobin" ] && user_gobin='$HOME/go/bin' ;# we want $HOME literal
281284
msg profile_path_add: issuing "$user_gobin" to "$abs_profiled"
282285
echo "export PATH=\$PATH:$user_gobin $dont_edit" >> "$abs_profiled"
283286

284287
if [ "$abs_goroot" != $default_goroot ]; then
285288
msg profile_path_add: setting up custom GOROOT="$abs_goroot" to "$abs_profiled"
286289
echo "export GOROOT=$abs_goroot $dont_edit" >> "$abs_profiled"
287290
fi
291+
chmod 755 "$abs_profiled"
288292
}
289293

290294
running_as_root() {

update-golang.sh.sha256

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2d890dfe07eab0700d14ccc282c1dd2ec737095e907b4cad3c71d1ec423d0e31 update-golang.sh
1+
6beb10c818f6dfc52d03803672b526acfabcb9b3fab231996e62366b95c0dd64 update-golang.sh

0 commit comments

Comments
 (0)