~michael-sheldon/ubuntu-touch-session/fix-1659388

« back to all changes in this revision

Viewing changes to ubuntu-session

  • Committer: Tarmac
  • Author(s): Ricardo Mendoza
  • Date: 2012-10-29 13:13:08 UTC
  • mfrom: (3.1.1 ubuntu-session-services)
  • Revision ID: tarmac-20121029131308-bmoycf11ze888yoh
* Pass a list of services to start depending on the device
* Wait for all children before exiting automatically
* Catch SIGTERM from upstart job to support restart/stop.

Approved by Bill Filler, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/bash
2
2
 
 
3
on_stop()
 
4
{
 
5
    echo "Stopping session..."
 
6
    kill ${DBUS_SESSION_BUS_PID}
 
7
}
 
8
 
3
9
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
4
10
    echo "Starting session bus"
5
 
    export `dbus-launch | grep -m1 ADDRESS`
 
11
    export `dbus-launch`
6
12
    if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
7
13
        echo "Unable to start session bus"
8
14
        exit 1
34
40
export EXTERNAL_STORAGE=/mnt/sdcard
35
41
export QT_PLUGIN_PATH=/opt/qt5/plugins
36
42
 
37
 
echo ${DBUS_SESSION_BUS_ADDRESS} > $HOME/.dbus-session
 
43
echo "DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS}" > $HOME/.dbus-session
 
44
echo "DBUS_SESSION_BUS_PID=${DBUS_SESSION_BUS_PID}" >> $HOME/.dbus-session
38
45
 
39
46
env
40
47
 
41
48
device=`grep Hardware /proc/cpuinfo | awk '{print $3}'`
42
49
 
43
50
if [ "$device" == "ventana" ]; then
44
 
    exec qml-tablet-shell
 
51
    services="/etc/tablet-services"
45
52
else
46
 
    exec qml-phone-shell
 
53
    services="/etc/phone-services"
47
54
fi
 
55
 
 
56
while read service; do
 
57
    $service &
 
58
done < "$services"
 
59
 
 
60
trap 'on_stop' TERM
 
61
 
 
62
wait