| 1 |
#!/bin/sh |
| 2 |
# -*- Mode: sh; indent-tabs-mode: nil; tab-width: 4 -*- |
| 3 |
# |
| 4 |
# Copyright (C) 2011 Canonical Ltd |
| 5 |
# Author: Michael Terry <[email protected]> |
| 6 |
# |
| 7 |
# This program is free software: you can redistribute it and/or modify it under |
| 8 |
# the terms of the GNU General Public License as published by the Free Software |
| 9 |
# Foundation, version 3 of the License. |
| 10 |
# |
| 11 |
# See http://www.gnu.org/copyleft/gpl.html the full text of the license. |
| 12 |
|
| 13 |
# This wrapper merely ensures that dbus-daemon lives only as long as this |
| 14 |
# script does. Otherwise, it's very easy for dbus-daemon to be autolaunched |
| 15 |
# and detached from the greeter. |
| 16 |
|
| 17 |
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin |
| 18 |
|
| 19 |
trap cleanup TERM EXIT |
| 20 |
|
| 21 |
cleanup() |
| 22 |
{ |
| 23 |
trap - TERM EXIT |
| 24 |
if [ -n "$DBUS_SESSION_BUS_PID" ]; then |
| 25 |
kill "$DBUS_SESSION_BUS_PID" |
| 26 |
fi |
| 27 |
if [ -n "$CMD_PID" ]; then |
| 28 |
kill "$CMD_PID" |
| 29 |
fi |
| 30 |
exit 0 |
| 31 |
} |
| 32 |
|
| 33 |
exec dbus-run-session $@ & |
| 34 |
CMD_PID=$! |
| 35 |
wait $CMD_PID |
| 36 |
CMD_PID= |