bundles/users: add option for custom tmux/bash/fish configs
This commit is contained in:
parent
810c2cfcf8
commit
eddb8ca70a
2 changed files with 24 additions and 6 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
from os.path import join, exists
|
||||||
|
|
||||||
directories = {}
|
directories = {}
|
||||||
users = {}
|
users = {}
|
||||||
files = {}
|
files = {}
|
||||||
|
@ -51,16 +53,32 @@ for username, attrs in node.metadata['users'].items():
|
||||||
else:
|
else:
|
||||||
files[home + '/.ssh/authorized_keys'] = {'delete': True}
|
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'] = {
|
files[home + '/.tmux.conf'] = {
|
||||||
'content_type': 'mako',
|
'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'] = {
|
files[home + '/.config/fish/config.fish'] = {
|
||||||
'content_type': 'mako',
|
'content_type': 'mako',
|
||||||
|
'source': fish_src
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if exists(join(repo.path, 'data', 'users', 'files', 'bash', '{}.bashrc'.format(username))):
|
||||||
for user, config in users.items():
|
files[home + '/.bashrc'] = {
|
||||||
files[config['home'] + '/.bashrc'] = {
|
'content_type': 'mako',
|
||||||
'delete': True,
|
'source': 'bash/{}.bashrc'.format(username),
|
||||||
}
|
}
|
||||||
|
else:
|
||||||
|
files[home + '/.bashrc'] = {
|
||||||
|
'delete': True,
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue