17 lines
652 B
Bash
17 lines
652 B
Bash
|
#!/bin/bash
|
||
|
# Get password using secret-tool and unlock keepassxc
|
||
|
# this currently only works for no password but key only unlock
|
||
|
database=${1:-$KEEPASS_DB_PATH}
|
||
|
keyfile=${2:-$KEEPASS_DB_KEY_PATH}
|
||
|
unlock="dbus-send --print-reply --dest=org.keepassxc.KeePassXC.MainWindow /keepassxc org.keepassxc.KeePassXC.MainWindow.openDatabase string:$database string:"" string:$keyfile"
|
||
|
if ! qdbus | grep keepassxc; then
|
||
|
keepassxc&
|
||
|
sleep 1
|
||
|
if ! qdbus | grep keepassxc; then echo unable to start keepassxc; exit; fi
|
||
|
fi
|
||
|
if $unlock &> /dev/null; then
|
||
|
echo keepass database $database succesfully unlocked
|
||
|
else
|
||
|
echo unable to unlock $database
|
||
|
fi
|