-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path40-path
85 lines (65 loc) · 1.35 KB
/
40-path
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#
# Add directory to PATH if it exists
#
function add_to_path
{
if [ -d "$1" ]; then
export PATH=$1:$PATH
fi
}
#
# Empty the PATH so we have a known-starting point.
#
export PATH=
#
# Add on the expected/standard directories.
#
add_to_path /bin
add_to_path /usr/bin
add_to_path /sbin
add_to_path /usr/sbin
add_to_path /usr/local/bin
add_to_path /usr/local/sbin
#
# Some optional directories might exist, and if so they will be added.
#
add_to_path /opt/node/bin
add_to_path /opt/packer
add_to_path /opt/pass
add_to_path /opt/sysadmin-util
add_to_path /opt/vpn
add_to_path /usr/games
add_to_path /usr/lib/ccache
add_to_path /var/lib/gems/1.8/bin
add_to_path /var/lib/gems/1.9/bin
#
# We allow a per-user, and a per-user + per-host setup.
#
add_to_path ~/bin/
add_to_path ~/bin-$(hostname --short)
#
# Now we have some extra setup for things that might be present.
#
#
# Golang
#
if [ -d /opt/go ]; then
# Add the path
add_to_path /opt/go/bin
add_to_path $HOME/go/bin
# go-specific environmental variable setup.
export GO111MODULE=on
export GOPATH=$HOME/go
export GOROOT=/opt/go
fi
#
# Ruby Gems
#
if [ -d ~/gems/bin ]; then
export GEM_HOME=~/gems/
add_to_path $HOME/gems/bin
fi
#
# Remove any duplicated entries.
#
export PATH=$(echo "$PATH" | awk -F: '{for (i=1;i<=NF;i++) { if ( !x[$i]++ ) printf("%s:",$i); }}')