improved script to start ssh-agent only if not started
also gets the socket environment set in the the call to unlockmaster
parent
be41e228fe
commit
3052888b9f
|
@ -1,14 +1,23 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
_dir="$(dirname $(realpath "${BASH_SOURCE:-$0}"))"
|
_dir="$(dirname $(realpath "${BASH_SOURCE:-$0}"))"
|
||||||
if systemctl --user cat ssh-agent &> /dev/null ; then
|
if systemctl --user is-active ssh-agent; then
|
||||||
echo starting user ssh-agent
|
echo starting keepass unlock for $1
|
||||||
systemctl --user restart ssh-agent
|
BASH_ENV=$HOME/ssh-agent.properties $_dir/keepassxc-unlock.sh "$@"
|
||||||
echo agent socket should be ssh-agent.sock not keyring
|
|
||||||
env | grep SSH_AUTH
|
|
||||||
echo sourcing ssh-agent properties at $HOME/ssh-agent.properties
|
|
||||||
cat $HOME/ssh-agent.properties
|
|
||||||
source $HOME/ssh-agent.properties
|
|
||||||
$_dir/keepassxc-unlock.sh "$@"
|
|
||||||
else
|
else
|
||||||
no ssh-agent service file for user $USER
|
if systemctl --user list-unit-files "ssh-agent.service"; then
|
||||||
|
echo starting user ssh-agent
|
||||||
|
if systemctl --user restart ssh-agent;then
|
||||||
|
sleep 2
|
||||||
|
cat $HOME/ssh-agent.properties
|
||||||
|
echo starting keepass unlock for $1
|
||||||
|
BASH_ENV=$HOME/ssh-agent.properties $_dir/keepassxc-unlock.sh "$@"
|
||||||
|
else
|
||||||
|
echo unable to start ssh-agent
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo can not start ageent, no user unit file ssh-agent.service for user $USER
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue