diff options
-rw-r--r-- | pass/.config/environment.d/50-password-store.conf | 1 | ||||
-rwxr-xr-x | pass/install.sh | 32 |
2 files changed, 33 insertions, 0 deletions
diff --git a/pass/.config/environment.d/50-password-store.conf b/pass/.config/environment.d/50-password-store.conf index 82a9c1e..064828b 100644 --- a/pass/.config/environment.d/50-password-store.conf +++ b/pass/.config/environment.d/50-password-store.conf @@ -1,2 +1,3 @@ PASSWORD_STORE_DIR=$XDG_DATA_HOME/pass PASSWORD_STORE_ENABLE_EXTENSIONS=true +PASSWORD_STORE_GPG_OPTS="--no-throw-keyids" diff --git a/pass/install.sh b/pass/install.sh new file mode 100755 index 0000000..2ab3f9e --- /dev/null +++ b/pass/install.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +pkgname=pass + +if ! command -v "$pkgname" >/dev/null; then + printf '%s: %s not found, skipping...\n' "$0" "$pkgname" + exit 0 +fi + +store=${PASSWORD_STORE_DIR:-$XDG_DATA_HOME/pass} + +if [ ! -d "$store" ]; then + printf "%s: Cloning password-store\n" "$0" + + git clone git@git.sr.ht:~tobyvin/.password-store "$store" +else + printf "%s: Syncing password-store\n" "$0" + + git remote update + + LOCAL=$(git rev-parse @) + REMOTE=$(git rev-parse '@{u}') + BASE=$(git merge-base @ '@{u}') + + if [ "$BASE" != "$REMOTE" ]; then + git -C "$store" pull + fi + + if [ "$BASE" != "$LOCAL" ]; then + git -C "$store" push + fi +fi |