summaryrefslogtreecommitdiff
path: root/debian/agent-launch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/agent-launch')
-rwxr-xr-xdebian/agent-launch23
1 files changed, 23 insertions, 0 deletions
diff --git a/debian/agent-launch b/debian/agent-launch
new file mode 100755
index 000000000..f3cbfaef8
--- /dev/null
+++ b/debian/agent-launch
@@ -0,0 +1,23 @@
1#!/bin/sh
2# helper script for launching ssh-agent, used by systemd unit
3set -e
4
5if [ ! -d "$XDG_RUNTIME_DIR" ]; then
6 echo 'This needs $XDG_RUNTIME_DIR to be set' >&2
7 exit 1
8fi
9
10if [ "$1" = start ]; then
11 if [ -z "$SSH_AUTH_SOCK" ] && grep -s -q '^use-ssh-agent$' /etc/X11/Xsession.options; then
12 S="$XDG_RUNTIME_DIR/openssh_agent"
13 dbus-update-activation-environment --verbose --systemd SSH_AUTH_SOCK=$S SSH_AGENT_LAUNCHER=openssh
14 exec ssh-agent -D -a $S
15 fi
16elif [ "$1" = stop ]; then
17 if [ "$SSH_AGENT_LAUNCHER" = openssh ]; then
18 dbus-update-activation-environment --systemd SSH_AUTH_SOCK=
19 fi
20else
21 echo "Unknown command $1" >&2
22 exit 1
23fi