From: hawk Date: Mon, 24 Nov 2008 10:53:11 +0000 (+0000) Subject: - init script for loading vboxvfs kernel module (regular users may use VirtualBox X-Git-Tag: auto/th/VirtualBox-2_0_6-2~1 X-Git-Url: https://git.pld-linux.org/?a=commitdiff_plain;h=d0f8d0fa3f95fc99e45e002bf32e645f85940490;p=packages%2FVirtualBox-bin.git - init script for loading vboxvfs kernel module (regular users may use VirtualBox but they are not allowed to load kernel modules so lets system do it at startup) Changed files: VirtualBox-vboxvfs.init -> 1.1 --- diff --git a/VirtualBox-vboxvfs.init b/VirtualBox-vboxvfs.init new file mode 100644 index 0000000..83581c3 --- /dev/null +++ b/VirtualBox-vboxvfs.init @@ -0,0 +1,61 @@ +#!/bin/sh +# +# virtualbox VirtualBox virtualizer for x86 hardware +# +# chkconfig: 345 84 25 +# +# description: InnoTek VirtualBox is a general-purpose full virtualizer for x86 +# hardware. Targeted at server, desktop and embedded use. +# +# $Id$ + +# Source function library +. /etc/rc.d/init.d/functions + +VBOX_DEVICE="/dev/vboxvfs" +VBOX_MODULE="vboxvfs" + +# Get service config - may override defaults +[ -f /etc/sysconfig/virtualbox ] && . /etc/sysconfig/virtualbox + +start() { + if [ ! -f /var/lock/subsys/vboxvfs ]; then + modprobe -s $VBOX_MODULE + # set proper /dev/vboxdrv for systems with static dev + touch /var/lock/subsys/vboxvfs + fi +} + +stop() { + # NOTE: rmmod will wait if device is in use, so automatic rmmod probably not the best idea + /sbin/rmmod $VBOX_MODULE + rm -f /var/lock/subsys/vboxvfs +} + +RETVAL=0 +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + status) + if ! is_module $VBOX_MODULE; then + echo "$VBOX_MODULE module is loaded" + else + echo "$VBOX_MODULE module is not loaded" + RETVAL=3 + fi + ;; + *) + msg_usage "$0 {start|stop|restart|status}" + exit 3 +esac + +exit $RETVAL