2020-03-27 13:33:37 +00:00
|
|
|
[ -z "$PS1" ] && return
|
|
|
|
|
|
|
|
__node_name="${node.name}"
|
|
|
|
|
|
|
|
<%text>
|
|
|
|
if [[ "$(id -u)" -eq 0 ]]
|
|
|
|
then
|
2021-03-14 16:14:08 +00:00
|
|
|
export PS1='\[\e[1;34m\][\[\e[1;91m\]'"$__node_name"'\[\e[1;34m\]][\[\e[1;91m\]\u\[\e[1;34m\]@\[\e[1;91m\]$PWD\[\e[1;34m\]] > \[\e[0m\]'
|
2020-03-27 13:33:37 +00:00
|
|
|
else
|
2021-03-14 16:14:08 +00:00
|
|
|
export PS1='\[\e[1;34m\][\[\e[1;32m\]'"$__node_name"'\[\e[1;34m\]][\[\e[1;32m\]\u\[\e[1;34m\]@\[\e[1;32m\]\w\[\e[1;34m\]] > \[\e[0m\]'
|
2020-03-27 13:33:37 +00:00
|
|
|
fi
|
|
|
|
case $TERM in
|
|
|
|
xterm*|rxvt*)
|
2021-03-14 16:14:08 +00:00
|
|
|
export PROMPT_COMMAND='echo -ne "\a\e]0;'"$__node_name"':${PWD}\a"'
|
2020-03-27 13:33:37 +00:00
|
|
|
;;
|
|
|
|
screen*)
|
2021-03-14 16:14:08 +00:00
|
|
|
export PROMPT_COMMAND='echo -ne "\a\ek'"$__node_name"':${PWD}\e\\"'
|
2020-03-27 13:33:37 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
unset PROMPT_COMMAND
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
uptime
|
|
|
|
last | grep 'still logged in'
|
2020-10-23 04:06:59 +00:00
|
|
|
|
|
|
|
alias v='vim -p'
|
|
|
|
alias l='ls -lAh'
|
2020-10-25 12:19:46 +00:00
|
|
|
alias ipb='ip -brief'
|
2020-10-25 12:21:04 +00:00
|
|
|
alias s='sudo -i'
|
2020-03-27 13:33:37 +00:00
|
|
|
</%text>
|
2020-10-25 12:19:46 +00:00
|
|
|
|
|
|
|
% for k, v in sorted(node.metadata.get('bash_aliases', {}).items()):
|
|
|
|
alias ${k}='${v}'
|
|
|
|
% endfor
|
2021-02-20 09:56:20 +00:00
|
|
|
% for k, v in sorted(node.metadata.get('bash_functions', {}).items()):
|
|
|
|
${k}() {
|
|
|
|
${v}
|
|
|
|
}
|
|
|
|
% endfor
|