forked from dnschneid/crouton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crouton-unity-autostart
executable file
·43 lines (38 loc) · 1.38 KB
/
crouton-unity-autostart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh -e
# Copyright (c) 2016 The crouton Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Helper script for launching services normally managed by upstart.
# Called during session's XDG autostart.
RELEASE="`/usr/local/bin/croutonversion -r`"
# Run the exec line from an Upstart conf file. Right now this assumes no space
# in the path and no arguments.
execfromconf() {
local exec_cmd="`awk '/^exec/{print $2; exit}' "$1"`"
if [ -x "$exec_cmd" ]; then
"$exec_cmd" &
fi
}
# Upstart launches unity on utopic, and this needs to be started before
# any dependent services.
if [ "$RELEASE" = 'utopic' ]; then
PATH="$PATH":/sbin /usr/bin/unity &
fi
# Launch window-stack-bridge for Unity HUD support, and unity-panel-service for
# indicators.
if [ "$RELEASE" != 'precise' ]; then
services="unity-panel-service window-stack-bridge"
for service in $services; do
conf_file=/usr/share/upstart/sessions/"$service".conf
execfromconf "$conf_file"
done
fi
# If on trusty or later, indicators also need to be started.
if [ "$RELEASE" = 'trusty' -o "$RELEASE" = 'utopic' ]; then
for conf_file in /usr/share/upstart/sessions/*.conf; do
if grep -q '^start on.* indicator-services-start' "$conf_file"; then
execfromconf "$conf_file"
fi
done
fi