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
|
2022-02-18 16:03:54 +00:00
|
|
|
unset PROMPT_COMMAND
|
2020-03-27 13:33:37 +00:00
|
|
|
|
2021-09-16 17:30:36 +00:00
|
|
|
if [[ -f "/etc/node.description" ]]
|
|
|
|
then
|
|
|
|
echo
|
|
|
|
cat "/etc/node.description"
|
|
|
|
echo
|
|
|
|
fi
|
|
|
|
|
2020-03-27 13:33:37 +00:00
|
|
|
uptime
|
|
|
|
last | grep 'still logged in'
|
2020-10-23 04:06:59 +00:00
|
|
|
|
2021-04-19 18:39:57 +00:00
|
|
|
export HISTCONTROL=ignoredups
|
|
|
|
export HISTSIZE=50000
|
|
|
|
export HISTTIMEFORMAT="%d/%m/%y %T "
|
|
|
|
export SAVEHIST=50000
|
|
|
|
shopt -s checkjobs
|
|
|
|
shopt -s checkwinsize
|
|
|
|
shopt -s globstar
|
|
|
|
shopt -s histreedit
|
|
|
|
|
|
|
|
export LESS="-iRS -# 2"
|
|
|
|
|
|
|
|
export EDITOR=vim
|
|
|
|
export VISUAL=vim
|
|
|
|
|
2020-10-25 12:19:46 +00:00
|
|
|
alias ipb='ip -brief'
|
2021-04-19 18:39:57 +00:00
|
|
|
alias l='ls -lAh'
|
2020-10-25 12:21:04 +00:00
|
|
|
alias s='sudo -i'
|
2021-04-19 18:39:57 +00:00
|
|
|
alias v='vim -p'
|
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-04-19 18:39:57 +00:00
|
|
|
|
|
|
|
rsback()
|
|
|
|
{
|
|
|
|
for i
|
|
|
|
do
|
|
|
|
[ -e "$i" ] || { echo "ERROR: $i does not exist" >&2; continue; }
|
|
|
|
printf 'rsync -zaP -e ssh %q ' '--rsync-path=sudo rsync'
|
|
|
|
printf '%q:%q .' "${node.hostname}" "$(printf '%q' "$(readlink -e -- "$i")")"
|
|
|
|
printf '\n'
|
|
|
|
done
|
|
|
|
}
|
2021-02-20 09:56:20 +00:00
|
|
|
% for k, v in sorted(node.metadata.get('bash_functions', {}).items()):
|
2021-04-19 18:39:57 +00:00
|
|
|
|
2021-02-20 09:56:20 +00:00
|
|
|
${k}() {
|
|
|
|
${v}
|
|
|
|
}
|
|
|
|
% endfor
|