blob: cb0f1e1cfbfe277154941f624a87e9c3a5244a36 (
plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
#!/bin/sh
# (C) 2007 Michael Meskes <meskes@debian.org>
### BEGIN INIT INFO
# Provides: vboxguest virtualbox-guest-utils
# Short-Description: VirtualBox Linux Additions
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
PATH=$PATH:/bin:/sbin:/usr/sbin
. /lib/lsb/init-functions
test -d /usr/share/doc/virtualbox-guest-utils -a -x /usr/sbin/VBoxService || exit 0
in_virtual_machine()
{
if [ -z "$(lspci -d 80ee:cafe)" ]; then
log_warning_msg "VirtualBox Additions disabled, not in a Virtual Machine"
return 1
fi
return 0
}
running()
{
lsmod | grep -q "$1[^_-]"
}
case "$1" in
start)
in_virtual_machine || exit 0
log_begin_msg "Starting VirtualBox Additions"
if ! running vboxguest; then
if ! modprobe vboxguest > /dev/null 2>&1; then
if ! find /lib/modules/`uname -r` -name "vboxguest\.*" 2>/dev/null|grep -q vboxguest; then
log_failure_msg "No suitable module for running kernel found"
else
log_failure_msg "modprobe vboxguest failed. Please use 'dmesg' to find out why"
fi
log_end_msg 1
return 1
fi
fi
if ! running vboxsf; then
if ! modprobe vboxsf > /dev/null 2>&1; then
if ! find /lib/modules/`uname -r` -name "vboxsf\.*" 2>/dev/null|grep -q vboxsf; then
log_failure_msg "No suitable module for running kernel found"
else
log_failure_msg "modprobe vboxsf failed. Please use 'dmesg' to find out why"
fi
log_end_msg 1
return 1
fi
fi
if /usr/bin/VBoxClient --check3d 2>/dev/null; then
setup_gl=true
else
unset setup_gl
fi
# Disable 3D if Xwayland is found, except on Ubuntu 18.04.
if type Xwayland >/dev/null 2>&1; then
unset PRETTY_NAME
. /etc/os-release 2>/dev/null
case "${PRETTY_NAME}" in
"Ubuntu 18.04"*) ;;
*) unset setup_gl ;;
esac
fi
if test -n "${setup_gl}"; then
if test -e /usr/lib/virtualbox/additions/00vboxvideo.conf; then
cp -f /usr/lib/virtualbox/additions/00vboxvideo.conf /etc/ld.so.conf.d/00vboxvideo.conf
ldconfig
fi
fi
/usr/bin/VBoxClient --vmsvga
start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/VBoxService
if [ $? -ne 0 ]; then
log_end_msg 1
exit 1
fi
log_end_msg 0
;;
stop)
in_virtual_machine || exit 0
log_begin_msg "Stopping VirtualBox Additions"
if test -e /etc/ld.so.conf.d/00vboxvideo.conf; then
rm -f /etc/ld.so.conf.d/00vboxvideo.conf
ldconfig
fi
start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/VBoxService
if [ $? -ne 0 ]; then
log_end_msg 1
exit 1
fi
log_end_msg 0
;;
restart|force-reload)
$0 stop && $0 start
;;
status)
if ! pgrep -x VBoxService > /dev/null; then
echo "VBoxService daemon isn't running"
exit 3
fi
exit 0
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status}"
exit 1
;;
esac
|