diff --git a/bundles/zsh/files/bw.zsh-theme b/bundles/zsh/files/bw.zsh-theme index 3cc6274..dbb370e 100644 --- a/bundles/zsh/files/bw.zsh-theme +++ b/bundles/zsh/files/bw.zsh-theme @@ -21,7 +21,7 @@ function spwd { echo } -indicator="$(whoami)@$(hostname -s)" +local indicator="$(whoami)@$(hostname -s)" local ret_status="%(?:%{$fg_bold[green]%}$indicator:%{$fg_bold[red]%}$indicator)" PROMPT='${ret_status} %{$fg[cyan]%}$(spwd)%{$reset_color%} $(git_prompt_info)' diff --git a/bundles/zsh/files/zprofile b/bundles/zsh/files/zprofile index 1a2e1e1..a838134 100644 --- a/bundles/zsh/files/zprofile +++ b/bundles/zsh/files/zprofile @@ -7,3 +7,10 @@ # Global Order: zshenv, zprofile, zshrc, zlogin alias s='sudo su - root -s /usr/bin/zsh' + +ZSH_THEME=bw +DISABLE_AUTO_UPDATE=true +plugins=( + zsh-autosuggestions +) +source /etc/zsh/oh-my-zsh/oh-my-zsh.sh diff --git a/bundles/zsh/files/zshrc b/bundles/zsh/files/zshrc deleted file mode 100644 index 35ee7f6..0000000 --- a/bundles/zsh/files/zshrc +++ /dev/null @@ -1,6 +0,0 @@ -export ZSH=~/.zsh/oh-my-zsh -ZSH_THEME=bw -plugins=( - zsh-autosuggestions -) -source $ZSH/oh-my-zsh.sh diff --git a/bundles/zsh/items.py b/bundles/zsh/items.py index 30629d4..f964334 100644 --- a/bundles/zsh/items.py +++ b/bundles/zsh/items.py @@ -1,66 +1,44 @@ from os.path import join +directories = { + '/etc/zsh/oh-my-zsh': {}, + '/etc/zsh/oh-my-zsh/custom/plugins/zsh-autosuggestions': { + 'mode': '644', + 'needs': [ + f"git_deploy:/etc/zsh/oh-my-zsh", + ] + }, + '/etc/zsh/oh-my-zsh/custom/plugins/zsh-autosuggestions': { + 'needs': [ + f"git_deploy:/etc/zsh/oh-my-zsh", + ] + }, +} + +git_deploy = { + '/etc/zsh/oh-my-zsh': { + 'repo': 'https://github.com/ohmyzsh/ohmyzsh.git', + 'rev': 'master', + }, + '/etc/zsh/oh-my-zsh/custom/plugins/zsh-autosuggestions': { + 'repo': 'https://github.com/zsh-users/zsh-autosuggestions.git', + 'rev': 'master', + }, +} + files = { '/etc/zsh/zprofile': {}, + '/etc/zsh/oh-my-zsh/themes/bw.zsh-theme': { + 'needs': [ + f"git_deploy:/etc/zsh/oh-my-zsh", + ] + }, } 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'): { + files[join(user_config['home'], '.zshrc')] = { '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, - }, - }) + 'content': '# bw managed', + }