search directory configured via environment

use absolute path to database file
This commit is contained in:
Jack Thomasson 2016-10-25 10:18:23 -06:00
parent 0138209004
commit 3ec29d3b52

View File

@ -1,5 +1,8 @@
#!/bin/bash #!/bin/bash
### change the path to suit your installation or set KDBX_SEARCH before calling ###
: ${KDBX_SEARCH:=~/.KeePass/*.kdbx}
PROG="$(basename $0)" PROG="$(basename $0)"
function daemon_main { function daemon_main {
@ -11,8 +14,8 @@ function daemon_main {
# fetch KeePass database passwords from kdewallet # fetch KeePass database passwords from kdewallet
declare -A DBs declare -A DBs
### change the path to suit your installation ### for DBPATH in $KDBX_SEARCH; do
for DBPATH in ~/.keepassx/*.kdbx; do [[ -L "$DBPATH" ]] && DBPATH=$(readlink --canonicalize "$DBPATH")
DBs[$DBPATH]=$(qdbus org.kde.kwalletd5 /modules/kwalletd5 org.kde.KWallet.readPassword "$handle" "Passwords" "$DBPATH" "$PROG") DBs[$DBPATH]=$(qdbus org.kde.kwalletd5 /modules/kwalletd5 org.kde.KWallet.readPassword "$handle" "Passwords" "$DBPATH" "$PROG")
done done