commit 13e86a6b56d5cfc8bef7e8c2fa4d65ff114ea57b
parent 3426b7b645dbaeb8822af0f67ff3f1ed534e1c80
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Sat, 31 Oct 2015 11:11:56 +0100
Merge branch 'master' of a3nm.net:git/mybin
Diffstat:
xpass | | | 15 | +++++++-------- |
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/xpass b/xpass
@@ -1,9 +1,12 @@
#!/bin/bash
# type passwords with xdotool, messages with zenity
-# usage: choose an entry in the dmenu to type the password for it
+# usage: choose a FILE in the dmenu to type the password for it
# type "FILE USER" to generate a new password for FILE and type it
-# additionally storing "USER" as second line in the file
+# (additionally storing "USER" as second line in the file)
+
+# for this script to work, you need a pinentry wrapper that prompts using GTK,
+# see e.g., my-pinentry which prompts in curses or GTK depending on environment
# inspired by similar scripts, e.g.:
# https://gist.github.com/ivyl/7429582
@@ -11,17 +14,13 @@
# http://git.zx2c4.com/password-store/tree/contrib/dmenu/passmenu (ships with pass)
# https://github.com/carnager/rofi-pass (much more featureful)
-# we need to prompt with gtk
-# this may work by default, otherwise, see the my-pinentry wrapper command
-# fortunately, pass uses gpg2
-
set -x
export PINENTRY_USER_DATA="gtk"
cd ~/.password-store
-# my-rofi is a dmenu wrapper
+# my-rofi is just a dmenu wrapper
RET=$(ls *.gpg | sed 's/\.gpg$//' | ~/bin/my-rofi)
if [ -z "$RET" ]
@@ -34,7 +33,7 @@ USER=$(echo "$RET" | awk '{print $2}')
if [ ! -f "${FILE}.gpg" ]
then
# file does not exist, create password
- # save anything specified on the commandline to the file
+ # also save anything specified on the commandline to the file
echo "generate"
echo -e "will be replaced by password\n$USER" | pass add -m "$FILE" || \
(zenity --error --text 'problem with pass add; aborting'; exit 2)