-
Notifications
You must be signed in to change notification settings - Fork 4
/
.bash_profile
79 lines (66 loc) · 1.95 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
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
reset=$(tput sgr0)
bold=$(tput bold)
export PS1="\[$reset\]\
bxshell[\
$bold\
(\$BXSHELL_TARGET) \
g:\$(cat ~/.bluemix/config.json | jq .ResourceGroup.Name -r) > \
r:\$(cat ~/.bluemix/config.json | jq .Region -r)\
$reset\
]\
\n\
\w> "
# Auto completion
. /usr/local/ibmcloud/autocomplete/bash_autocomplete
source <(kubectl completion bash)
source <(oc completion bash)
source <(helm completion bash)
source <(stern --completion bash)
# Istio
export PATH="$PATH:/usr/local/istio/bin"
# disable Terraform calling home
# https://www.terraform.io/docs/commands/index.html#disable_checkpoint
export CHECKPOINT_DISABLE=true
# History
export HISTFILE=$HOME/mnt/config/.bash_history
export PROMPT_COMMAND='history -a'
# Additional customization per env
if [ -f ~/mnt/config/.env_profile ]; then
echo Loading custom environment profile
. ~/mnt/config/.env_profile
fi
# Powerline
if [[ $BXSHELL_ENABLE_POWERLINE ]]; then
mkdir -p /root/.config/powerline-shell
# link the user configuration
if [ -f ~/mnt/config/powerline-shell-config.json ]; then
ln -s ~/mnt/config/powerline-shell-config.json ~/.config/powerline-shell/config.json
# or the default if no custom config
else
ln -s /opt/support/powerline-shell/config.json ~/.config/powerline-shell/config.json
fi
function _update_ps1() {
PS1=$(powerline-shell $?)
}
if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
fi
# Done only on the login shell
if [ "$SHLVL" == "1" ]; then
if [ -d "$HOME/mnt/home/.ssh" ]; then
ln -s $HOME/mnt/home/.ssh/ $HOME/.ssh
fi
cat $HOME/.motd.txt
if [ ! "x$CONTAINER_NAME" = x ]; then
echo Port mapping at your convenience:
docker port $CONTAINER_NAME | awk '{print $1 " -> " $3 " -> http://" $3}'
fi
fi
# change directory to a directory under the user home dir
if [ ! "x$CONTAINER_STARTUP_DIR" = x ]; then
cd "$CONTAINER_STARTUP_DIR"
fi