bundlewrap/bundles/zsh/items.py
2022-06-01 11:34:12 +02:00

66 lines
1.9 KiB
Python

from os.path import join
files = {
'/etc/zsh/zprofile': {},
}
for name, user_config in node.metadata.get('users').items():
if user_config.get('shell', None) != '/usr/bin/zsh':
continue
directories.update({
join(user_config['home'], '.zsh'): {
'owner': name,
'group': name,
},
join(user_config['home'], '.zsh/oh-my-zsh'): {
'owner': name,
'group': name,
},
join(user_config['home'], '.zsh/oh-my-zsh/custom/plugins/zsh-autosuggestions'): {
'owner': name,
'group': name,
'needs': [
f"git_deploy:{join(user_config['home'], '.zsh/oh-my-zsh')}",
]
},
})
git_deploy.update({
join(user_config['home'], '.zsh/oh-my-zsh'): {
'repo': 'https://github.com/ohmyzsh/ohmyzsh.git',
'rev': 'master',
'triggers': [
f'action:chown_zsh_{name}',
],
},
join(user_config['home'], '.zsh/oh-my-zsh/custom/plugins/zsh-autosuggestions'): {
'repo': 'https://github.com/zsh-users/zsh-autosuggestions.git',
'rev': 'master',
'triggers': [
f'action:chown_zsh_{name}',
],
},
})
files.update({
join(user_config['home'], '.zshrc'): {
'owner': name,
'group': name,
'source': 'zshrc',
},
join(user_config['home'], '.zsh/oh-my-zsh/themes/bw.zsh-theme'): {
'owner': name,
'group': name,
'needs': [
f"git_deploy:{join(user_config['home'], '.zsh/oh-my-zsh')}",
]
},
})
actions.update({
f'chown_zsh_{name}': {
'command': f"chown -R {name}:{name} {user_config['home']}",
'triggered': True,
},
})