2023-12-20 17:24:54 -08:00
|
|
|
#!/bin/bash
|
|
|
|
_dir="$(dirname $(realpath "${BASH_SOURCE:-$0}"))"
|
2024-02-12 14:16:57 -08:00
|
|
|
# echo at $@ >> ~/Desktop/ssh.log
|
2023-12-21 11:03:09 -08:00
|
|
|
if systemctl --user is-active ssh-agent; then
|
|
|
|
echo starting keepass unlock for $1
|
|
|
|
BASH_ENV=$HOME/ssh-agent.properties $_dir/keepassxc-unlock.sh "$@"
|
|
|
|
else
|
|
|
|
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
|
2024-02-12 14:16:57 -08:00
|
|
|
SSH_AUTH_SOCK=$(cat $HOME/ssh-agent.properties) $_dir/keepassxc-unlock.sh "$@"
|
2023-12-21 11:03:09 -08:00
|
|
|
else
|
|
|
|
echo unable to start ssh-agent
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo can not start ageent, no user unit file ssh-agent.service for user $USER
|
|
|
|
fi
|
2023-12-20 17:24:54 -08:00
|
|
|
fi
|
2023-12-21 11:03:09 -08:00
|
|
|
|
|
|
|
|
|
|
|
|