summaryrefslogtreecommitdiffstats
path: root/bin/req_pwd.sh
diff options
context:
space:
mode:
authorTharre <tharre3@gmail.com>2018-05-09 02:58:18 +0200
committerTharre <tharre3@gmail.com>2018-05-09 17:28:13 +0200
commit321d9a8247d50cd634615ffed707aed3f4376108 (patch)
tree32fbd27e3a9e8c3f41d68232ffe203ef0ce10999 /bin/req_pwd.sh
parent3cb67ddae1d11e4cda22b9843665b6d3775828da (diff)
downloaddotfiles-321d9a8247d50cd634615ffed707aed3f4376108.tar.gz
dotfiles-321d9a8247d50cd634615ffed707aed3f4376108.tar.xz
dotfiles-321d9a8247d50cd634615ffed707aed3f4376108.zip
Move various scripts and functions into bin/
Diffstat (limited to 'bin/req_pwd.sh')
-rwxr-xr-xbin/req_pwd.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/bin/req_pwd.sh b/bin/req_pwd.sh
new file mode 100755
index 0000000..3a6be86
--- /dev/null
+++ b/bin/req_pwd.sh
@@ -0,0 +1,19 @@
+#!/bin/sh -e
+# A simple wrapper script to deal with situations where pass, password-store, or
+# my gpg key is not available.
+
+pass "$1" && exit
+
+# maybe gpg-agent is acting up, retry after restarting it
+gpg-connect-agent "KILLAGENT" /bye >&2 >/dev/null
+gpg-connect-agent /bye >&2 >/dev/null
+pass "$1" && exit
+
+# if pass fails, request password manually
+stty -echo
+printf "Password: " >&2
+read passwd
+stty echo
+printf "\n" >&2
+
+printf "$passwd"