From cf12e48c411e0e27b2d615f68691ba15844352c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Sun, 3 Oct 2021 12:24:11 +0200 Subject: [PATCH] Add pass wrapper to check out store --- bin/mypass | 2 +- user.yml | 28 ++++++++++++++++++---------- zsh/zshrc.d/20_aliases.sh | 2 -- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/bin/mypass b/bin/mypass index d1ee328..fdb59dd 100755 --- a/bin/mypass +++ b/bin/mypass @@ -4,7 +4,7 @@ import sys import subprocess import yaml -PASS = 'pass' +PASS = '/usr/bin/pass' def run(args): return(subprocess.run( diff --git a/user.yml b/user.yml index bc1209b..a747d08 100644 --- a/user.yml +++ b/user.yml @@ -589,15 +589,23 @@ tags: [gpg] - block: - - name: stat passwordstore checkout - stat: - path: /home/{{ user.name }}/.password-store - register: passwordstore_checkout - - name: check out passwordstore repository - git: - dest: /home/{{ user.name }}/.password-store - repo: ssh://git@code.hkoerber.de:2222/hannes/passwordstore.git - accept_hostkey: true - when: not passwordstore_checkout.stat.exists + - name: add passwordstore init script + copy: + dest: /home/{{ user.name }}/bin/pass + owner: "{{ user.name }}" + group: "{{ user_group_name }}" + mode: '0755' + content: | + #!/usr/bin/env bash + + if [[ ! -e ~/.password-store ]] ; then + printf '%s\n' 'This is the first time running pass, initializting repository ...' + + git clone ssh://git@code.hkoerber.de:2222/hannes/passwordstore.git ~/.password-store + + printf '%s\n' 'Done' + fi + + exec mypass "${@}" when: user.enable_passwordstore|default(false) is sameas true tags: [passwordstore] diff --git a/zsh/zshrc.d/20_aliases.sh b/zsh/zshrc.d/20_aliases.sh index 7b7ae2b..b77bbdc 100644 --- a/zsh/zshrc.d/20_aliases.sh +++ b/zsh/zshrc.d/20_aliases.sh @@ -73,8 +73,6 @@ alias json2yaml="python3 -c 'import sys, yaml, json; yaml.safe_dump(json.loads(s alias currentbranch='git rev-parse --abbrev-ref HEAD' -alias pass=mypass - alias issh="ssh -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null" alias gfix='git commit --amend --no-edit' alias gfixa='git commit --amend --no-edit --all '