Compare commits

...

2 commits

Author SHA1 Message Date
mwiegand
b9ff7e5953 manage global zprofile 2022-06-01 11:34:12 +02:00
mwiegand
8063833950 fix overwrite dicts 2022-06-01 11:33:59 +02:00
2 changed files with 21 additions and 8 deletions

View file

@ -0,0 +1,9 @@
# /etc/zsh/zprofile: system-wide .zprofile file for zsh(1).
#
# This file is sourced only for login shells (i.e. shells
# invoked with "-" as the first character of argv[0], and
# shells invoked with the -l flag.)
#
# Global Order: zshenv, zprofile, zshrc, zlogin
alias s='sudo su - root -s /usr/bin/zsh'

View file

@ -1,10 +1,14 @@
from os.path import join from os.path import join
files = {
'/etc/zsh/zprofile': {},
}
for name, user_config in node.metadata.get('users').items(): for name, user_config in node.metadata.get('users').items():
if user_config.get('shell', None) != '/usr/bin/zsh': if user_config.get('shell', None) != '/usr/bin/zsh':
continue continue
directories = { directories.update({
join(user_config['home'], '.zsh'): { join(user_config['home'], '.zsh'): {
'owner': name, 'owner': name,
'group': name, 'group': name,
@ -20,9 +24,9 @@ for name, user_config in node.metadata.get('users').items():
f"git_deploy:{join(user_config['home'], '.zsh/oh-my-zsh')}", f"git_deploy:{join(user_config['home'], '.zsh/oh-my-zsh')}",
] ]
}, },
} })
git_deploy = { git_deploy.update({
join(user_config['home'], '.zsh/oh-my-zsh'): { join(user_config['home'], '.zsh/oh-my-zsh'): {
'repo': 'https://github.com/ohmyzsh/ohmyzsh.git', 'repo': 'https://github.com/ohmyzsh/ohmyzsh.git',
'rev': 'master', 'rev': 'master',
@ -37,9 +41,9 @@ for name, user_config in node.metadata.get('users').items():
f'action:chown_zsh_{name}', f'action:chown_zsh_{name}',
], ],
}, },
} })
files = { files.update({
join(user_config['home'], '.zshrc'): { join(user_config['home'], '.zshrc'): {
'owner': name, 'owner': name,
'group': name, 'group': name,
@ -52,11 +56,11 @@ for name, user_config in node.metadata.get('users').items():
f"git_deploy:{join(user_config['home'], '.zsh/oh-my-zsh')}", f"git_deploy:{join(user_config['home'], '.zsh/oh-my-zsh')}",
] ]
}, },
} })
actions = { actions.update({
f'chown_zsh_{name}': { f'chown_zsh_{name}': {
'command': f"chown -R {name}:{name} {user_config['home']}", 'command': f"chown -R {name}:{name} {user_config['home']}",
'triggered': True, 'triggered': True,
}, },
} })