~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to etc/init.d/virtualbox-guest-x11

  • Committer: Dimitri John Ledkov
  • Date: 2014-05-06 18:45:46 UTC
  • Revision ID: dimitri.ledkov@canonical.com-20140506184546-5toyx56xxrue0f0v
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
# (C) 2012 Felix Geyer <fgeyer@debian@org>
3
 
 
4
 
### BEGIN INIT INFO
5
 
# Provides:          virtualbox-guest-x11
6
 
# Short-Description: VirtualBox Linux X11 Additions
7
 
# Required-Start:    $remote_fs
8
 
# Required-Stop:
9
 
# Default-Start:     S
10
 
# Default-Stop:
11
 
### END INIT INFO
12
 
 
13
 
PATH=$PATH:/bin:/sbin:/usr/sbin
14
 
 
15
 
. /lib/lsb/init-functions
16
 
 
17
 
test -e /usr/lib/VBoxOGL.so || exit 0
18
 
 
19
 
in_virtual_machine()
20
 
{
21
 
        if [ -z "$(lspci -d 80ee:beef)" ]; then
22
 
                log_warning_msg "VirtualBox Additions disabled, not in a Virtual Machine"
23
 
                return 1
24
 
        fi
25
 
 
26
 
        return 0
27
 
}
28
 
 
29
 
running()
30
 
{
31
 
    lsmod | grep -q "$1[^_-]"
32
 
}
33
 
 
34
 
case "$1" in
35
 
  start)
36
 
        in_virtual_machine || exit 0
37
 
        log_begin_msg "Loading VirtualBox video kernel module"
38
 
 
39
 
        if ! running vboxvideo; then
40
 
                if ! modprobe vboxvideo > /dev/null 2>&1; then
41
 
                        if ! find /lib/modules/`uname -r` -name "vboxvideo\.*" 2>/dev/null|grep -q vboxvideo; then
42
 
                                log_failure_msg "No suitable module for running kernel found"
43
 
                        else
44
 
                                log_failure_msg "modprobe vboxvideo failed. Please use 'dmesg' to find out why"
45
 
                        fi
46
 
                        log_end_msg 1
47
 
                        exit 1
48
 
                fi
49
 
        fi
50
 
 
51
 
        log_end_msg 0
52
 
        ;;
53
 
 
54
 
  stop)
55
 
        ;;
56
 
 
57
 
  restart|force-reload)
58
 
        $0 start
59
 
        ;;
60
 
 
61
 
  *)
62
 
        echo "Usage: $0 {start|stop|restart|force-reload}"
63
 
        exit 1
64
 
        ;;
65
 
esac
66
 
 
67
 
exit 0