diff options
author | Stéphane Graber <stgraber@ubuntu.com> | 2013-03-25 16:55:41 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2013-03-25 16:55:41 +0000 |
commit | 0062ebe7b4e524952eb2fb79e38d8bc3f3b213ef (patch) | |
tree | a73fef54f767e25d77b5d90678279e401d73152d /debian/ssh-agent.user-session.upstart | |
parent | fb0148c9ba78689cd03c9cf2ee05a4fa22a0ed69 (diff) |
Add ssh-agent upstart user job. This implements something similar to
the 90x11-common_ssh-agent Xsession script. That is, start ssh-agent
and set the appropriate environment variables (closes: #703906).
Diffstat (limited to 'debian/ssh-agent.user-session.upstart')
-rw-r--r-- | debian/ssh-agent.user-session.upstart | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/debian/ssh-agent.user-session.upstart b/debian/ssh-agent.user-session.upstart new file mode 100644 index 000000000..8553e12f1 --- /dev/null +++ b/debian/ssh-agent.user-session.upstart | |||
@@ -0,0 +1,19 @@ | |||
1 | description "SSH Agent" | ||
2 | author "Stéphane Graber <stgraber@ubuntu.com>" | ||
3 | |||
4 | start on starting xsession-init | ||
5 | |||
6 | pre-start script | ||
7 | [ -e /etc/X11/Xsession.options ] || { stop; exit 0; } | ||
8 | grep -q "^use-ssh-agent$" /etc/X11/Xsession.options || { stop; exit 0; } | ||
9 | |||
10 | eval "$(ssh-agent)" >/dev/null | ||
11 | initctl set-env --global SSH_AUTH_SOCK=$SSH_AUTH_SOCK | ||
12 | initctl set-env --global SSH_AGENT_PID=$SSH_AGENT_PID | ||
13 | end script | ||
14 | |||
15 | post-stop script | ||
16 | kill $SSH_AGENT_PID 2>/dev/null || true | ||
17 | initctl unset-env --global SSH_AUTH_SOCK | ||
18 | initctl unset-env --global SSH_AGENT_PID | ||
19 | end script | ||