VirtualBox

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

Last change on this file since 82263 was 81763, checked in by vboxsync, 5 years ago

INstaller/linux: Honor VBOX_WITH_PCI_PASSTHROUGH during packing and modify vboxdrv.sh to not fail when vboxpci is not available

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