bundles/users: also deploy shell config

This commit is contained in:
Franzi 2020-03-27 13:33:37 +00:00
parent 6656a0864f
commit 841b49cd18
Signed by: kunsi
GPG key ID: 12E3D2136B818350
3 changed files with 63 additions and 0 deletions

View file

@ -0,0 +1,26 @@
[ -z "$PS1" ] && return
__node_name="${node.name}"
<%text>
if [[ "$(id -u)" -eq 0 ]]
then
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\]] $PRODWARNING> \[\e[0m\]'
else
export PS1='\[\e[1;0m\]['"$__node_name"'][\u@\w]\[\e[1;34m\] $PRODWARNING\[\e[1;0m\]> '
fi
case $TERM in
xterm*|rxvt*)
export PROMPT_COMMAND='echo -ne "\a\e]0;'"$__node_name"':${PWD/$HOME/~}\a"'
;;
screen*)
export PROMPT_COMMAND='echo -ne "\a\ek'"$__node_name"':${PWD/$HOME/~}\e\\"'
;;
*)
unset PROMPT_COMMAND
;;
esac
uptime
last | grep 'still logged in'
</%text>

View file

@ -0,0 +1,23 @@
function fish_greeting
uptime
last | grep 'still logged in'
end
function fish_prompt
set -l last_status $status
echo -n "$USER@${node.name}:"
set_color $fish_color_cwd
echo -n (pwd)
set_color normal
if not test $last_status -eq 0
set_color $fish_color_error
echo -n " [$status]"
set_color normal
end
echo -n '➤ '
set_color normal
end

View file

@ -14,6 +14,11 @@ users['root'] = {
'password': repo.vault.human_password_for('root on {}'.format(node.name)),
}
files['/etc/bash.bashrc'] = {
'source': 'bashrc',
'content_type': 'mako',
}
for username, attrs in node.metadata['users'].items():
home = attrs.get('home', '/home/{}'.format(username))
@ -46,3 +51,12 @@ for username, attrs in node.metadata['users'].items():
else:
files[home + '/.ssh/authorized_keys'] = {'delete': True}
files[home + '/.config/fish/config.fish'] = {
'content_type': 'mako',
}
for user, config in users.items():
files[config['home'] + '/.bashrc'] = {
'delete': True,
}