bundles/users: add option for custom tmux/bash/fish configs

This commit is contained in:
Franzi 2020-03-28 12:56:45 +01:00
parent 810c2cfcf8
commit eddb8ca70a
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 24 additions and 6 deletions

View file

@ -1,3 +1,5 @@
from os.path import join, exists
directories = {}
users = {}
files = {}
@ -51,16 +53,32 @@ for username, attrs in node.metadata['users'].items():
else:
files[home + '/.ssh/authorized_keys'] = {'delete': True}
if exists(join(repo.path, 'data', 'users', 'files', 'tmux', '{}.conf'.format(username))):
tmux_src = 'tmux/{}.conf'.format(username)
else:
tmux_src = 'tmux.conf'
files[home + '/.tmux.conf'] = {
'content_type': 'mako',
'source': 'tmux.conf',
'source': tmux_src,
}
if exists(join(repo.path, 'data', 'users', 'files', 'fish', '{}.conf'.format(username))):
fish_src = 'fisk/{}.conf'.format(username)
else:
fish_src = 'fish.conf'
files[home + '/.config/fish/config.fish'] = {
'content_type': 'mako',
'source': fish_src
}
for user, config in users.items():
files[config['home'] + '/.bashrc'] = {
'delete': True,
}
if exists(join(repo.path, 'data', 'users', 'files', 'bash', '{}.bashrc'.format(username))):
files[home + '/.bashrc'] = {
'content_type': 'mako',
'source': 'bash/{}.bashrc'.format(username),
}
else:
files[home + '/.bashrc'] = {
'delete': True,
}