From 7e580ef99764ee53115735cee279582d5d31d9f0 Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Sat, 1 Aug 2020 14:53:37 +0200 Subject: [PATCH] moved salt from alias to functin, added username pillar --- .alias | 1 - .functions.sh | 11 ++--------- salt/README.md | 4 +++- salt/pillars/vim.sls | 21 ++++++++++----------- salt/states/vim.sls | 8 +++----- 5 files changed, 18 insertions(+), 27 deletions(-) diff --git a/.alias b/.alias index e3c0503..c5440ad 100644 --- a/.alias +++ b/.alias @@ -6,4 +6,3 @@ alias dotf='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME' alias ls_dotfiels='/usr/bin/git --git-dir=$HOME/.dotfiles ls-tree --full-tree -r --name-only HEAD' alias t="todo.sh" alias gl='git log --graph --pretty=format:'\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit --date=relative' -alias salt='sudo salt-call --local --file-root "$HOME/salt/states" --pillar-root "$HOME/salt/pillars" "$@"' diff --git a/.functions.sh b/.functions.sh index 7db480c..88126a2 100644 --- a/.functions.sh +++ b/.functions.sh @@ -1,12 +1,5 @@ -function gnomebindings(){ - local KEY_PATH="/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings" - local CMD="gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:$KEY_PATH" - gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['$KEY_PATH/custom0/']" - - # Open Terminator - $CMD/custom0/ name "Open Terminator" - $CMD/custom0/ command "terminator" - $CMD/custom0/ binding "Return" +function salt() { + sudo salt-call --local --file-root "$HOME/salt/states" --pillar-root "$HOME/salt/pillars" "$@" pillar="{username: $USER}" } function pw(){ diff --git a/salt/README.md b/salt/README.md index d3c3e24..bc70425 100644 --- a/salt/README.md +++ b/salt/README.md @@ -1,3 +1,5 @@ ``` -alias salt='sudo salt-call --local --file-root "$HOME/salt/states" --pillar-root "$HOME/salt/pillars" "$@"' +function salt(){ + sudo salt-call --local --file-root "$HOME/salt/states" --pillar-root "$HOME/salt/pillars" "$@" pillar="{username: $USER}" +} ``` diff --git a/salt/pillars/vim.sls b/salt/pillars/vim.sls index fdd5f00..56ffc0f 100644 --- a/salt/pillars/vim.sls +++ b/salt/pillars/vim.sls @@ -3,15 +3,14 @@ packages: vim: plugins: - jonas: - calendar-vim: - name: https://github.com/mattn/calendar-vim.git - vim-commentary: - name: https://github.com/tpope/vim-commentary.git - vim-instant-markdown: - name: https://github.com/suan/vim-instant-markdown.git - vim-surround: - name: https://github.com/tpope/vim-surround.git - vimwiki: - name: https://github.com/vimwiki/vimwiki.git + calendar-vim: + name: https://github.com/mattn/calendar-vim.git + vim-commentary: + name: https://github.com/tpope/vim-commentary.git + vim-instant-markdown: + name: https://github.com/suan/vim-instant-markdown.git + vim-surround: + name: https://github.com/tpope/vim-surround.git + vimwiki: + name: https://github.com/vimwiki/vimwiki.git diff --git a/salt/states/vim.sls b/salt/states/vim.sls index d624369..088bee8 100644 --- a/salt/states/vim.sls +++ b/salt/states/vim.sls @@ -1,9 +1,7 @@ -{% for user, plugins in pillar['vim']['plugins'].items() %} -{% for plugin, args in plugins.items() %} +{% for plugin, args in pillar['vim']['plugins'].items() %} {{ plugin }}: git.latest: - name: {{ args['name'] }} - - target: {{ salt['user.info']( user ).home }}/.vim/bundle/{{ plugin }} - - user: {{ user }} -{% endfor %} + - target: {{ salt['user.info']( pillar['username'] ).home }}/.vim/bundle/{{ plugin }} + - user: {{ pillar['username'] }} {% endfor %}