-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_bash_profile
210 lines (174 loc) · 4.84 KB
/
_bash_profile
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# -*- mode: sh -*-
# .bash_profile
#
# $Id: .bash_profile,v 1.1 2004/05/03 15:39:59 roth Exp $
#
# Ted's .bash_profile
#
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
if [ -e ~/.xenvironment ]; then
. ~/.xenvironment
fi
# This makes it easier to deal with schroot which shares the $HOME dir
# in chroots.
OS_REL=$(lsb_release -irs | tr '\n' ' ' | tr ' ' '-' | sed -e 's/-$//')
export OS_REL
unset PATH
PATH=/usr/local/bin:/usr/bin:/bin
# Add things that are usually only in root's path.
PATH=$PATH:/usr/local/sbin
PATH=$PATH:/usr/sbin
PATH=$PATH:/sbin
# Add all my home paths one at a time so that they are easy to comment
# out.
HOME_PATHS_PREPEND=(
${HOME}/.cargo/bin
${HOME}/.opt/kitty/bin
${HOME}/local/${OS_REL}/emacs/bin
)
HOME_PATHS_APPEND=(
${HOME}/local/${OS_REL}/bin
${HOME}/local/bin
${HOME}/.local/bin
${HOME}/.platformio/penv/bin
${HOME}/AppImages
${HOME}/bin
)
HOME_MAN_PATHS=(
#${HOME}/local/${OS_REL}/man
#${HOME}/local/man
#${HOME}/.local/man
)
HOME_LD_LIB_PATHS=(
#${HOME}/local/${OS_REL}/lib
#${HOME}/local/lib
#${HOME}/.local/lib
)
for p in "${HOME_PATHS_PREPEND[@]}"
do
if [ -d "${p}" ]; then
PATH="${p}:${PATH}"
fi
done
for p in "${HOME_PATHS_APPEND[@]}"
do
if [ -d "${p}" ]; then
PATH="${PATH}:${p}"
fi
done
for p in "${HOME_MAN_PATHS[@]}"
do
if [ -d "${p}" ]; then
MANPATH="${MANPATH}:${p}"
fi
done
for p in "${HOME_LD_LIB_PATHS[@]}"
do
if [ -d "${p}" ]; then
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${p}"
fi
done
#
# CDPATH sets up search pathes for the `cd` command in bash so you don't need
# to provide the full path to a directory you use often.
#
unset CDPATH
CDPATH=.
CDPATH=$CDPATH:~/work/judo
CDPATH=$CDPATH:~/work/judo/judo-main/build/tmp/deploy/images
CDPATH=$CDPATH:~/work/judo/judo-main/build/tmp/work
CDPATH=$CDPATH:~/work/bedrock
CDPATH=$CDPATH:~/work/bedrock/bedrock-main/build-rpi4/tmp/deploy/images
CDPATH=$CDPATH:~/work/bedrock/bedrock-main/build-rpi4/tmp/work
CDPATH=$CDPATH:~/git
CDPATH=$CDPATH:~/yocto
export PATH
export MANPATH
export LD_LIBRARY_PATH
export CDPATH
export EDITOR=vim
export LC_COLLATE=C
export CSCOPE_EDITOR="$HOME/bin/emacsclient-nowait"
#
# See man pages for tput(1) and terminfo(5)
# See also: https://wiki.archlinux.org/title/Bash/Prompt_customization
#
blk=$(printf -- "\001$(tput setaf 0)\002")
red=$(printf -- "\001$(tput setaf 1)\002")
grn=$(printf -- "\001$(tput setaf 2)\002")
yel=$(printf -- "\001$(tput setaf 3)\002")
blu=$(printf -- "\001$(tput setaf 4)\002")
mag=$(printf -- "\001$(tput setaf 5)\002")
cyn=$(printf -- "\001$(tput setaf 6)\002")
wht=$(printf -- "\001$(tput setaf 7)\002")
prp=$(printf -- "\001$(tput setaf 13)\002")
prmpt=$(printf -- "\001$(tput setaf 9)\002")
bold=$(printf -- "\001$(tput bold)\002")
dim=$(printf -- "\001$(tput dim)\002")
reset=$(printf -- "\001$(tput sgr0)\002")
__prompt_header ()
{
(
# Display the prompt header.
printf "\n${dim}${grn}### ${blu}[$(\date '+%r')]${cyn}[${OS_REL}]${reset}"
__git_ps1 "${bold}${red} Branch: %s"
# Show the pushd/popd directory stack. The 'tail -n +2' skips the first
# directory since that is shown above.
cnt=1
for d in $(dirs -p | tail -n +2)
do
printf "\n${reset}${dim}${grn}### %4d : ${prp}%s" $(( cnt++ )) "${d}"
done
printf "\n${reset}${dim}${grn}### [${USER}@$(hostname)] ${prp}[$(dirs +0)]\n"
printf "${reset}"
# Update the title in the terminal.
printf "\033]0;bash\007"
) 2>/dev/null
}
PROMPT_COMMAND=( __prompt_header )
PS1='${bold}${grn}### ${prmpt}>--> \$${reset} '
export PROMPT_COMMAND PS1
# Load a local profile if it exists
if [ -f ~/.bash_profile_local ]; then
. ~/.bash_profile_local
fi
# Set up ccache if it is installed.
LIB_DIRS=(
/usr/lib
/usr/lib64
/usr/lib32
)
for LIB in ${LIB_DIRS[@]}
do
if [ -d ${LIB}/ccache ] && [ -x ${LIB}/ccache/gcc ]
then
PATH=${LIB}/ccache:$PATH
export PATH
break
fi
done
#
# Setup common downloads and sstate directories to be shared by all Yocto/OE
# builds.
#
mkdir -p "$HOME/Yocto/Downloads"
export DL_DIR="$HOME/Yocto/Downloads"
mkdir -p "$HOME/Yocto/SState"
export SSTATE_DIR="$HOME/Yocto/SState"
mkdir -p "$HOME/Yocto/HashEq"
export HASH_EQUIV_DIR="$HOME/Yocto/HashEq"
# Variables we need bitbake to get from environment.
TROTH_PASSTHROUGH_ADDITIONS=(
DL_DIR
SSTATE_DIR
HASH_EQUIV_DIR
)
# Yocto is changing use of WHITELIST naming to PASSTHROUGH to improve DEI
# wording (Diversity, Equity, Inclusivity). I'm still using to old variable
# names here for backwards compatibility.
export BB_ENV_PASSTHROUGH_ADDITIONS="${BB_ENV_PASSTHROUGH_ADDITIONS} ${TROTH_PASSTHROUGH_ADDITIONS[@]}"
export BB_ENV_EXTRAWHITE="${BB_ENV_EXTRAWHITE} ${TROTH_PASSTHROUGH_ADDITIONS[@]}"
${ENV_YOCTO_INIT}