[ -z "$PS1" ] && return

__node_name="${node.name}"

<%text>
if [[ "$(id -u)" -eq 0 ]]
then
    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\]'
else
    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\]'
fi
case $TERM in
    xterm*|rxvt*)
        export PROMPT_COMMAND='echo -ne "\a\e]0;'"$__node_name"':${PWD}\a"'
        ;;
    screen*)
        export PROMPT_COMMAND='echo -ne "\a\ek'"$__node_name"':${PWD}\e\\"'
        ;;
    *)
        unset PROMPT_COMMAND
        ;;
esac

uptime
last | grep 'still logged in'

alias v='vim -p'
alias l='ls -lAh'
alias ipb='ip -brief'
alias s='sudo -i'
</%text>

% for k, v in sorted(node.metadata.get('bash_aliases', {}).items()):
alias ${k}='${v}'
% endfor
% for k, v in sorted(node.metadata.get('bash_functions', {}).items()):
${k}() {
    ${v}
}
% endfor