aboutsummaryrefslogtreecommitdiff
path: root/home/dot_local/share/pass-extensions/executable_directory.bash
diff options
context:
space:
mode:
Diffstat (limited to 'home/dot_local/share/pass-extensions/executable_directory.bash')
-rw-r--r--home/dot_local/share/pass-extensions/executable_directory.bash12
1 files changed, 12 insertions, 0 deletions
diff --git a/home/dot_local/share/pass-extensions/executable_directory.bash b/home/dot_local/share/pass-extensions/executable_directory.bash
new file mode 100644
index 0000000..84db500
--- /dev/null
+++ b/home/dot_local/share/pass-extensions/executable_directory.bash
@@ -0,0 +1,12 @@
+#!/bin/bash
+# print the initialized password store directory as a fully qualified path.
+# exits with code 1 if the password store is not initialized.
+dir="${PASSWORD_STORE_DIR-$HOME/.password-store}"
+dir="$(realpath "$dir")"
+if [ -e "$dir/.gpg-id" ] ; then
+ echo "$dir"
+else
+ echo "error: password store is not initialized" >&2
+ exit 1
+fi
+