-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile
More file actions
136 lines (118 loc) · 2.97 KB
/
profile
File metadata and controls
136 lines (118 loc) · 2.97 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/sh
#
# Profile script
#
# Load shell environment variables and other settings propagated to sub-shells
#
# Load includes
CALLER=profile . "${SHELL_PROFILE_PATH}/script_functions"
if hasFlag "${SHELL_PROFILE_FLAG_PROFILE_DONE}"; then
msgDebug "Skipping profile, already run.\n"
return
fi
setFlag "${SHELL_PROFILE_FLAG_PROFILE_DONE}"
msgDebug "==> Running profile script\n"
#
# Get platform
#
SHELL_PROFILE_PLATFORM=$(getPlatform)
if [ "${SHELL_PROFILE_PLATFORM}" = "unknown" ]; then
msgDebug "Unknown platform detected!\n"
else
msgDebug "Detected platform ${SHELL_PROFILE_PLATFORM}\n"
fi
#
# Define pager
#
if [ -x /usr/bin/less ]; then
export PAGER="/usr/bin/less -ins"
elif [ -x /usr/bin/more ]; then
export PAGER="/usr/bin/more -s"
fi
#
# Set ls options
#
if [ "${TERM}" != "dumb" ]; then
case "${SHELL_PROFILE_PLATFORM}" in
"darwin")
LS_OPTIONS="-G"
export LSCOLORS="dxfxcxdxbxegedabagacad"
;;
*)
if [ -f ~/.dir_colors ]; then
msgDebug "Found ~/.dir_colors, setting ls environment variables...\n"
LS_OPTIONS="--color=auto"
eval $(dircolors ~/.dir_colors)
fi
;;
esac
fi
#
# Check for and add common paths
#
msgDebug "Setting PATH...\n"
msgDebug "Current PATH=${PATH}\n"
if [ $((${SHELL_PROFILE_ADD_COMMON_PATHS:-1})) -eq 1 ]; then
msgDebug "Adding common paths...\n"
SHELL_PROFILE_COMMON_PATHS=$(cat <<_SHELL_PROFILE_COMMON_PATHS_END
/bin
/sbin
/usr/bin
/usr/sbin
/usr/local/bin
/usr/local/sbin
/opt/local/bin
/opt/local/sbin
$HOME/bin
_SHELL_PROFILE_COMMON_PATHS_END
)
addPaths "${SHELL_PROFILE_COMMON_PATHS}"
fi
#
# Add paths from SHELL_PROFILE_LOCAL_PATH_PREPEND_FILE
#
if [ -f "${SHELL_PROFILE_LOCAL_PATH_PREPEND_FILE}" ]; then
msgDebug "Prepending paths from ${SHELL_PROFILE_LOCAL_PATH_PREPEND_FILE}...\n"
addPaths "$(cat "${SHELL_PROFILE_LOCAL_PATH_PREPEND_FILE}")"
fi
#
# Add paths from SHELL_PROFILE_LOCAL_PATH_APPEND_FILE
#
if [ -f "${SHELL_PROFILE_LOCAL_PATH_APPEND_FILE}" ]; then
msgDebug "Appending paths from ${SHELL_PROFILE_LOCAL_PATH_APPEND_FILE}...\n"
addPaths "$(cat "${SHELL_PROFILE_LOCAL_PATH_APPEND_FILE}")" after
fi
msgDebug "Loading shell functions\n"
. "${SHELL_PROFILE_PATH}/shell_functions"
#
# Run profile.local if it exists
#
if [ -f "${SHELL_PROFILE_PATH}/profile.local" ]; then
msgDebug "Starting profile.local...\n"
. "${SHELL_PROFILE_PATH}/profile.local"
fi
#
# Set shell options for interactive shells
#
case $- in
*i*)
case "${SHELL}" in
*bash)
if [ -r "$HOME/.bashrc" ] && ! hasFlag $SHELL_PROFILE_FLAG_BASHRC_DONE; then
msgDebug "Starting bashrc script...\n"
. "$HOME/.bashrc"
fi
;;
esac
;;
esac
#
# Export vars
#
export PATH LS_OPTIONS OS_TYPE
msgDebug "==> Done in profile script\n"
#
# Clean up
#
cleanUp profile
# vim: syntax=sh:ts=4:sw=4