summaryrefslogtreecommitdiffstats
path: root/bin/req_pwd.sh
diff options
context:
space:
mode:
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"