VirtualBox

source: vbox/trunk/src/VBox/Installer/linux/vboxdrv.sh@ 79804

Last change on this file since 79804 was 79186, checked in by vboxsync, 6 years ago

Installers/Linux: support Ubuntu-s DKMS secure boot tools.
bugref:9199: Linux host kernel modules and UEFI secure boot.
Ubuntu (and soon Debian) provides infrastructure for signing kernel modules
for use with secure boot for use with DKMS. This change makes our Linux host
installer use this infrastructure if it is found, and warn about modules to
be signed if not.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 20.0 KB
Line 
1#! /bin/sh
2# Oracle VM VirtualBox
3# Linux kernel module init script
4
5#
6# Copyright (C) 2006-2019 Oracle Corporation
7#
8# This file is part of VirtualBox Open Source Edition (OSE), as
9# available from http://www.virtualbox.org. This file is free software;
10# you can redistribute it and/or modify it under the terms of the GNU
11# General Public License (GPL) as published by the Free Software
12# Foundation, in version 2 as it comes in the "COPYING" file of the
13# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15#
16
17# chkconfig: 345 20 80
18# description: VirtualBox Linux kernel module
19#
20### BEGIN INIT INFO
21# Provides: vboxdrv
22# Required-Start: $syslog
23# Required-Stop:
24# Default-Start: 2 3 4 5
25# Default-Stop: 0 1 6
26# Short-Description: VirtualBox Linux kernel module
27### END INIT INFO
28
29## @todo This file duplicates a lot of script with vboxadd.sh. When making
30# changes please try to reduce differences between the two wherever possible.
31
32## @todo Remove the stop_vms target so that this script is only relevant to
33# kernel modules. Nice but not urgent.
34
35PATH=/sbin:/bin:/usr/sbin:/usr/bin:$PATH
36DEVICE=/dev/vboxdrv
37MODPROBE=/sbin/modprobe
38SCRIPTNAME=vboxdrv.sh
39
40# The below is GNU-specific. See VBox.sh for the longer Solaris/OS X version.
41TARGET=`readlink -e -- "${0}"` || exit 1
42SCRIPT_DIR="${TARGET%/[!/]*}"
43
44if $MODPROBE -c | grep -q '^allow_unsupported_modules *0'; then
45 MODPROBE="$MODPROBE --allow-unsupported-modules"
46fi
47
48setup_log()
49{
50 test -n "${LOG}" && return 0
51 # Rotate log files
52 LOG="/var/log/vbox-setup.log"
53 mv "${LOG}.3" "${LOG}.4" 2>/dev/null
54 mv "${LOG}.2" "${LOG}.3" 2>/dev/null
55 mv "${LOG}.1" "${LOG}.2" 2>/dev/null
56 mv "${LOG}" "${LOG}.1" 2>/dev/null
57}
58
59[ -f /etc/vbox/vbox.cfg ] && . /etc/vbox/vbox.cfg
60export BUILD_TYPE
61export USERNAME
62export USER=$USERNAME
63
64if test -n "${INSTALL_DIR}" && test -x "${INSTALL_DIR}/VirtualBox"; then
65 MODULE_SRC="${INSTALL_DIR}/src/vboxhost"
66elif test -x /usr/lib/virtualbox/VirtualBox; then
67 INSTALL_DIR=/usr/lib/virtualbox
68 MODULE_SRC="/usr/share/virtualbox/src/vboxhost"
69elif test -x "${SCRIPT_DIR}/VirtualBox"; then
70 # Executing from the build directory
71 INSTALL_DIR="${SCRIPT_DIR}"
72 MODULE_SRC="${INSTALL_DIR}/src"
73else
74 # Silently exit if the package was uninstalled but not purged.
75 # Applies to Debian packages only (but shouldn't hurt elsewhere)
76 exit 0
77fi
78VIRTUALBOX="${INSTALL_DIR}/VirtualBox"
79VBOXMANAGE="${INSTALL_DIR}/VBoxManage"
80BUILDINTMP="${MODULE_SRC}/build_in_tmp"
81if test -u "${VIRTUALBOX}"; then
82 GROUP=root
83 DEVICE_MODE=0600
84else
85 GROUP=vboxusers
86 DEVICE_MODE=0660
87fi
88
89KERN_VER=`uname -r`
90MODULE_LIST="vboxdrv vboxnetflt vboxnetadp vboxpci"
91# Secure boot state.
92case "`mokutil --sb-state 2>/dev/null`" in
93 *"disabled in shim"*) unset HAVE_SEC_BOOT;;
94 *"SecureBoot enabled"*) HAVE_SEC_BOOT=true;;
95 *) unset HAVE_SEC_BOOT;;
96esac
97# So far we can only sign modules on Ubuntu and on Debian 10 and later.
98DEB_PUB_KEY=/var/lib/shim-signed/mok/MOK.der
99DEB_PRIV_KEY=/var/lib/shim-signed/mok/MOK.priv
100unset HAVE_DEB_KEY
101case "`mokutil --test-key "$DEB_PUB_KEY" 2>/dev/null`" in
102 *"is already"*) DEB_KEY_ENROLLED=true;;
103 *) unset DEB_KEY_ENROLLED;;
104esac
105
106[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
107
108# Preamble for Gentoo
109if [ "`which $0`" = "/sbin/rc" ]; then
110 shift
111fi
112
113begin_msg()
114{
115 test -n "${2}" && echo "${SCRIPTNAME}: ${1}."
116 logger -t "${SCRIPTNAME}" "${1}."
117}
118
119succ_msg()
120{
121 logger -t "${SCRIPTNAME}" "${1}."
122}
123
124fail_msg()
125{
126 echo "${SCRIPTNAME}: failed: ${1}." >&2
127 logger -t "${SCRIPTNAME}" "failed: ${1}."
128}
129
130failure()
131{
132 fail_msg "$1"
133 exit 1
134}
135
136running()
137{
138 lsmod | grep -q "$1[^_-]"
139}
140
141log()
142{
143 setup_log
144 echo "${1}" >> "${LOG}"
145}
146
147module_build_log()
148{
149 setup_log
150 echo "${1}" | egrep -v \
151 "^test -e include/generated/autoconf.h|^echo >&2|^/bin/false\)$" \
152 >> "${LOG}"
153}
154
155## Output the vboxdrv part of our udev rule. This is redirected to the right file.
156udev_write_vboxdrv() {
157 VBOXDRV_GRP="$1"
158 VBOXDRV_MODE="$2"
159
160 echo "KERNEL==\"vboxdrv\", NAME=\"vboxdrv\", OWNER=\"root\", GROUP=\"$VBOXDRV_GRP\", MODE=\"$VBOXDRV_MODE\""
161 echo "KERNEL==\"vboxdrvu\", NAME=\"vboxdrvu\", OWNER=\"root\", GROUP=\"root\", MODE=\"0666\""
162 echo "KERNEL==\"vboxnetctl\", NAME=\"vboxnetctl\", OWNER=\"root\", GROUP=\"$VBOXDRV_GRP\", MODE=\"$VBOXDRV_MODE\""
163}
164
165## Output the USB part of our udev rule. This is redirected to the right file.
166udev_write_usb() {
167 INSTALLATION_DIR="$1"
168 USB_GROUP="$2"
169
170 echo "SUBSYSTEM==\"usb_device\", ACTION==\"add\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh \$major \$minor \$attr{bDeviceClass}${USB_GROUP}\""
171 echo "SUBSYSTEM==\"usb\", ACTION==\"add\", ENV{DEVTYPE}==\"usb_device\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh \$major \$minor \$attr{bDeviceClass}${USB_GROUP}\""
172 echo "SUBSYSTEM==\"usb_device\", ACTION==\"remove\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh --remove \$major \$minor\""
173 echo "SUBSYSTEM==\"usb\", ACTION==\"remove\", ENV{DEVTYPE}==\"usb_device\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh --remove \$major \$minor\""
174}
175
176## Generate our udev rule file. This takes a change in udev rule syntax in
177## version 55 into account. It only creates rules for USB for udev versions
178## recent enough to support USB device nodes.
179generate_udev_rule() {
180 VBOXDRV_GRP="$1" # The group owning the vboxdrv device
181 VBOXDRV_MODE="$2" # The access mode for the vboxdrv device
182 INSTALLATION_DIR="$3" # The directory VirtualBox is installed in
183 USB_GROUP="$4" # The group that has permission to access USB devices
184 NO_INSTALL="$5" # Set this to "1" to remove but not re-install rules
185
186 # Extra space!
187 case "$USB_GROUP" in ?*) USB_GROUP=" $USB_GROUP" ;; esac
188 case "$NO_INSTALL" in "1") return ;; esac
189 udev_write_vboxdrv "$VBOXDRV_GRP" "$VBOXDRV_MODE"
190 udev_write_usb "$INSTALLATION_DIR" "$USB_GROUP"
191}
192
193## Install udev rule (disable with INSTALL_NO_UDEV=1 in
194## /etc/default/virtualbox).
195install_udev() {
196 VBOXDRV_GRP="$1" # The group owning the vboxdrv device
197 VBOXDRV_MODE="$2" # The access mode for the vboxdrv device
198 INSTALLATION_DIR="$3" # The directory VirtualBox is installed in
199 USB_GROUP="$4" # The group that has permission to access USB devices
200 NO_INSTALL="$5" # Set this to "1" to remove but not re-install rules
201
202 if test -d /etc/udev/rules.d; then
203 generate_udev_rule "$VBOXDRV_GRP" "$VBOXDRV_MODE" "$INSTALLATION_DIR" \
204 "$USB_GROUP" "$NO_INSTALL"
205 fi
206 # Remove old udev description file
207 rm -f /etc/udev/rules.d/10-vboxdrv.rules 2> /dev/null
208}
209
210## Create a usb device node for a given sysfs path to a USB device.
211install_create_usb_node_for_sysfs() {
212 path="$1" # sysfs path for the device
213 usb_createnode="$2" # Path to the USB device node creation script
214 usb_group="$3" # The group to give ownership of the node to
215 if test -r "${path}/dev"; then
216 dev="`cat "${path}/dev" 2> /dev/null`"
217 major="`expr "$dev" : '\(.*\):' 2> /dev/null`"
218 minor="`expr "$dev" : '.*:\(.*\)' 2> /dev/null`"
219 class="`cat ${path}/bDeviceClass 2> /dev/null`"
220 sh "${usb_createnode}" "$major" "$minor" "$class" \
221 "${usb_group}" 2>/dev/null
222 fi
223}
224
225udev_rule_file=/etc/udev/rules.d/60-vboxdrv.rules
226sysfs_usb_devices="/sys/bus/usb/devices/*"
227
228## Install udev rules and create device nodes for usb access
229setup_usb() {
230 VBOXDRV_GRP="$1" # The group that should own /dev/vboxdrv
231 VBOXDRV_MODE="$2" # The mode to be used for /dev/vboxdrv
232 INSTALLATION_DIR="$3" # The directory VirtualBox is installed in
233 USB_GROUP="$4" # The group that should own the /dev/vboxusb device
234 # nodes unless INSTALL_NO_GROUP=1 in
235 # /etc/default/virtualbox. Optional.
236 usb_createnode="$INSTALLATION_DIR/VBoxCreateUSBNode.sh"
237 # install udev rule (disable with INSTALL_NO_UDEV=1 in
238 # /etc/default/virtualbox)
239 if [ "$INSTALL_NO_GROUP" != "1" ]; then
240 usb_group=$USB_GROUP
241 vboxdrv_group=$VBOXDRV_GRP
242 else
243 usb_group=root
244 vboxdrv_group=root
245 fi
246 install_udev "${vboxdrv_group}" "$VBOXDRV_MODE" \
247 "$INSTALLATION_DIR" "${usb_group}" \
248 "$INSTALL_NO_UDEV" > ${udev_rule_file}
249 # Build our device tree
250 for i in ${sysfs_usb_devices}; do # This line intentionally without quotes.
251 install_create_usb_node_for_sysfs "$i" "${usb_createnode}" \
252 "${usb_group}"
253 done
254}
255
256cleanup_usb()
257{
258 # Remove udev description file
259 rm -f /etc/udev/rules.d/60-vboxdrv.rules
260 rm -f /etc/udev/rules.d/10-vboxdrv.rules
261
262 # Remove our USB device tree
263 rm -rf /dev/vboxusb
264}
265
266start()
267{
268 begin_msg "Starting VirtualBox services" console
269 if [ -d /proc/xen ]; then
270 failure "Running VirtualBox in a Xen environment is not supported"
271 fi
272 if test -n "$HAVE_SEC_BOOT" && test -z "$DEB_KEY_ENROLLED"; then
273 if test -n "$HAVE_DEB_KEY"; then
274 begin_msg "You must re-start your system to finish Debian secure boot set-up." console
275 else
276 begin_msg "You must sign these kernel modules before using VirtualBox:
277 $MODULE_LIST
278See the documenatation for your Linux distribution." console
279 fi
280 return 0
281 fi
282 if ! running vboxdrv; then
283 if ! rm -f $DEVICE; then
284 failure "Cannot remove $DEVICE"
285 fi
286 if ! $MODPROBE vboxdrv > /dev/null 2>&1; then
287 setup
288 if ! $MODPROBE vboxdrv > /dev/null 2>&1; then
289 failure "modprobe vboxdrv failed. Please use 'dmesg' to find out why"
290 fi
291 fi
292 sleep .2
293 fi
294 # ensure the character special exists
295 if [ ! -c $DEVICE ]; then
296 MAJOR=`sed -n 's;\([0-9]\+\) vboxdrv$;\1;p' /proc/devices`
297 if [ ! -z "$MAJOR" ]; then
298 MINOR=0
299 else
300 MINOR=`sed -n 's;\([0-9]\+\) vboxdrv$;\1;p' /proc/misc`
301 if [ ! -z "$MINOR" ]; then
302 MAJOR=10
303 fi
304 fi
305 if [ -z "$MAJOR" ]; then
306 rmmod vboxdrv 2>/dev/null
307 failure "Cannot locate the VirtualBox device"
308 fi
309 if ! mknod -m 0660 $DEVICE c $MAJOR $MINOR 2>/dev/null; then
310 rmmod vboxdrv 2>/dev/null
311 failure "Cannot create device $DEVICE with major $MAJOR and minor $MINOR"
312 fi
313 fi
314 # ensure permissions
315 if ! chown :"${GROUP}" $DEVICE 2>/dev/null; then
316 rmmod vboxpci 2>/dev/null
317 rmmod vboxnetadp 2>/dev/null
318 rmmod vboxnetflt 2>/dev/null
319 rmmod vboxdrv 2>/dev/null
320 failure "Cannot change group ${GROUP} for device $DEVICE"
321 fi
322 if ! $MODPROBE vboxnetflt > /dev/null 2>&1; then
323 failure "modprobe vboxnetflt failed. Please use 'dmesg' to find out why"
324 fi
325 if ! $MODPROBE vboxnetadp > /dev/null 2>&1; then
326 failure "modprobe vboxnetadp failed. Please use 'dmesg' to find out why"
327 fi
328 if ! $MODPROBE vboxpci > /dev/null 2>&1; then
329 failure "modprobe vboxpci failed. Please use 'dmesg' to find out why"
330 fi
331 # Create the /dev/vboxusb directory if the host supports that method
332 # of USB access. The USB code checks for the existance of that path.
333 if grep -q usb_device /proc/devices; then
334 mkdir -p -m 0750 /dev/vboxusb 2>/dev/null
335 chown root:vboxusers /dev/vboxusb 2>/dev/null
336 fi
337 # Remove any kernel modules left over from previously installed kernels.
338 cleanup only_old
339 succ_msg "VirtualBox services started"
340}
341
342stop()
343{
344 begin_msg "Stopping VirtualBox services" console
345
346 if running vboxpci; then
347 if ! rmmod vboxpci 2>/dev/null; then
348 failure "Cannot unload module vboxpci"
349 fi
350 fi
351 if running vboxnetadp; then
352 if ! rmmod vboxnetadp 2>/dev/null; then
353 failure "Cannot unload module vboxnetadp"
354 fi
355 fi
356 if running vboxdrv; then
357 if running vboxnetflt; then
358 if ! rmmod vboxnetflt 2>/dev/null; then
359 failure "Cannot unload module vboxnetflt"
360 fi
361 fi
362 if ! rmmod vboxdrv 2>/dev/null; then
363 failure "Cannot unload module vboxdrv"
364 fi
365 if ! rm -f $DEVICE; then
366 failure "Cannot unlink $DEVICE"
367 fi
368 fi
369 succ_msg "VirtualBox services stopped"
370}
371
372# enter the following variables in /etc/default/virtualbox:
373# SHUTDOWN_USERS="foo bar"
374# check for running VMs of user foo and user bar
375# SHUTDOWN=poweroff
376# SHUTDOWN=acpibutton
377# SHUTDOWN=savestate
378# select one of these shutdown methods for running VMs
379stop_vms()
380{
381 wait=0
382 for i in $SHUTDOWN_USERS; do
383 # don't create the ipcd directory with wrong permissions!
384 if [ -d /tmp/.vbox-$i-ipc ]; then
385 export VBOX_IPC_SOCKETID="$i"
386 VMS=`$VBOXMANAGE --nologo list runningvms | sed -e 's/^".*".*{\(.*\)}/\1/' 2>/dev/null`
387 if [ -n "$VMS" ]; then
388 if [ "$SHUTDOWN" = "poweroff" ]; then
389 begin_msg "Powering off remaining VMs"
390 for v in $VMS; do
391 $VBOXMANAGE --nologo controlvm $v poweroff
392 done
393 succ_msg "Remaining VMs powered off"
394 elif [ "$SHUTDOWN" = "acpibutton" ]; then
395 begin_msg "Sending ACPI power button event to remaining VMs"
396 for v in $VMS; do
397 $VBOXMANAGE --nologo controlvm $v acpipowerbutton
398 wait=30
399 done
400 succ_msg "ACPI power button event sent to remaining VMs"
401 elif [ "$SHUTDOWN" = "savestate" ]; then
402 begin_msg "Saving state of remaining VMs"
403 for v in $VMS; do
404 $VBOXMANAGE --nologo controlvm $v savestate
405 done
406 succ_msg "State of remaining VMs saved"
407 fi
408 fi
409 fi
410 done
411 # wait for some seconds when doing ACPI shutdown
412 if [ "$wait" -ne 0 ]; then
413 begin_msg "Waiting for $wait seconds for VM shutdown"
414 sleep $wait
415 succ_msg "Waited for $wait seconds for VM shutdown"
416 fi
417}
418
419cleanup()
420{
421 # If this is set, only remove kernel modules for no longer installed
422 # kernels. Note that only generated kernel modules should be placed
423 # in /lib/modules/*/misc. Anything that we should not remove automatically
424 # should go elsewhere.
425 only_old="${1}"
426 for i in /lib/modules/*; do
427 # Check whether we are only cleaning up for uninstalled kernels.
428 test -n "${only_old}" && test -e "${i}/kernel/drivers" && continue
429 # We could just do "rm -f", but we only want to try deleting folders if
430 # we are sure they were ours, i.e. they had our modules in beforehand.
431 if test -e "${i}/misc/vboxdrv.ko" \
432 || test -e "${i}/misc/vboxnetadp.ko" \
433 || test -e "${i}/misc/vboxnetflt.ko" \
434 || test -e "${i}/misc/vboxpci.ko"; then
435 rm -f "${i}/misc/vboxdrv.ko" "${i}/misc/vboxnetadp.ko" \
436 "${i}/misc/vboxnetflt.ko" "${i}/misc/vboxpci.ko"
437 version=`expr "${i}" : "/lib/modules/\(.*\)"`
438 depmod -a "${version}"
439 sync
440 fi
441 # Remove the kernel version folder if it was empty except for us.
442 test "`echo ${i}/misc/* ${i}/misc/.?* ${i}/* ${i}/.?*`" \
443 = "${i}/misc/* ${i}/misc/.. ${i}/misc ${i}/.." &&
444 rmdir "${i}/misc" "${i}" # We used to leave empty folders.
445 done
446}
447
448# setup_script
449setup()
450{
451 begin_msg "Building VirtualBox kernel modules" console
452 log "Building the main VirtualBox module."
453 if ! myerr=`$BUILDINTMP \
454 --save-module-symvers /tmp/vboxdrv-Module.symvers \
455 --module-source "$MODULE_SRC/vboxdrv" \
456 --no-print-directory install 2>&1`; then
457 "${INSTALL_DIR}/check_module_dependencies.sh" || exit 1
458 log "Error building the module:"
459 module_build_log "$myerr"
460 failure "Look at $LOG to find out what went wrong"
461 fi
462 log "Building the net filter module."
463 if ! myerr=`$BUILDINTMP \
464 --use-module-symvers /tmp/vboxdrv-Module.symvers \
465 --module-source "$MODULE_SRC/vboxnetflt" \
466 --no-print-directory install 2>&1`; then
467 log "Error building the module:"
468 module_build_log "$myerr"
469 failure "Look at $LOG to find out what went wrong"
470 fi
471 log "Building the net adaptor module."
472 if ! myerr=`$BUILDINTMP \
473 --use-module-symvers /tmp/vboxdrv-Module.symvers \
474 --module-source "$MODULE_SRC/vboxnetadp" \
475 --no-print-directory install 2>&1`; then
476 log "Error building the module:"
477 module_build_log "$myerr"
478 failure "Look at $LOG to find out what went wrong"
479 fi
480 log "Building the PCI pass-through module."
481 if ! myerr=`$BUILDINTMP \
482 --use-module-symvers /tmp/vboxdrv-Module.symvers \
483 --module-source "$MODULE_SRC/vboxpci" \
484 --no-print-directory install 2>&1`; then
485 log "Error building the module:"
486 module_build_log "$myerr"
487 failure "Look at $LOG to find out what went wrong"
488 fi
489 rm -f /etc/vbox/module_not_compiled
490 depmod -a
491 sync
492 succ_msg "VirtualBox kernel modules built"
493 # Secure boot on Ubuntu and Debian.
494 if test -n "$HAVE_SEC_BOOT" &&
495 type update-secureboot-policy >/dev/null 2>&1; then
496 SHIM_NOTRIGGER=y update-secureboot-policy --new-key
497 fi
498 if test -f "$DEB_PUB_KEY" && test -f "$DEB_PRIV_KEY"; then
499 HAVE_DEB_KEY=true
500 for i in $MODULE_LIST; do
501 kmodsign sha512 /var/lib/shim-signed/mok/MOK.priv \
502 /var/lib/shim-signed/mok/MOK.der \
503 /lib/modules/"$KERN_VER"/misc/"$i".ko
504 done
505 # update-secureboot-policy "expects" DKMS modules.
506 # Work around this and talk to the authors as soon
507 # as possible to fix it.
508 mkdir -p /var/lib/dkms/vbox-temp
509 update-secureboot-policy --enroll-key 2>/dev/null ||
510 begin_msg "Failed to enroll secure boot key." console
511 rmdir -p /var/lib/dkms/vbox-temp 2>/dev/null
512 fi
513}
514
515dmnstatus()
516{
517 if running vboxdrv; then
518 str="vboxdrv"
519 if running vboxnetflt; then
520 str="$str, vboxnetflt"
521 if running vboxnetadp; then
522 str="$str, vboxnetadp"
523 fi
524 fi
525 if running vboxpci; then
526 str="$str, vboxpci"
527 fi
528 echo "VirtualBox kernel modules ($str) are loaded."
529 for i in $SHUTDOWN_USERS; do
530 # don't create the ipcd directory with wrong permissions!
531 if [ -d /tmp/.vbox-$i-ipc ]; then
532 export VBOX_IPC_SOCKETID="$i"
533 VMS=`$VBOXMANAGE --nologo list runningvms | sed -e 's/^".*".*{\(.*\)}/\1/' 2>/dev/null`
534 if [ -n "$VMS" ]; then
535 echo "The following VMs are currently running:"
536 for v in $VMS; do
537 echo " $v"
538 done
539 fi
540 fi
541 done
542 else
543 echo "VirtualBox kernel module is not loaded."
544 fi
545}
546
547case "$1" in
548start)
549 start
550 ;;
551stop)
552 stop_vms
553 stop
554 ;;
555stop_vms)
556 stop_vms
557 ;;
558restart)
559 stop && start
560 ;;
561setup)
562 test -n "${2}" && export KERN_VER="${2}"
563 # Create udev rule and USB device nodes.
564 ## todo Wouldn't it make more sense to install the rule to /lib/udev? This
565 ## is not a user-created configuration file after all.
566 ## todo Do we need a udev rule to create /dev/vboxdrv[u] at all? We have
567 ## working fall-back code here anyway, and the "right" code is more complex
568 ## than the fall-back. Unnecessary duplication?
569 stop && cleanup
570 setup_usb "$GROUP" "$DEVICE_MODE" "$INSTALL_DIR"
571 start
572 ;;
573cleanup)
574 stop && cleanup
575 cleanup_usb
576 ;;
577force-reload)
578 stop
579 start
580 ;;
581status)
582 dmnstatus
583 ;;
584*)
585 echo "Usage: $0 {start|stop|stop_vms|restart|force-reload|status}"
586 exit 1
587esac
588
589exit 0
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette