#!/sbin/runscript # Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: depend() { need localmount before xdm } createvboxdevice() { local maj min maj=`sed -n 's;\([0-9]\+\) vboxadd;\1;p' /proc/devices` if ! [[ -z $maj ]] ; then min=0 else min=`sed -n 's;\([0-9]\+\) vboxadd;\1;p' /proc/misc` if ! [[ -z $min ]] ; then maj=10 fi fi mknod /dev/vboxadd c $maj $min -m 0664 &> /dev/null } start() { ebegin "Starting VirtualBox guest additions" if [[ -e /dev/vboxadd ]] ; then rm -f /dev/vboxadd &> /dev/null fi einfo " Loading kernel modules and creating devices" /sbin/modprobe vboxadd &> /dev/null createvboxdevice /sbin/modprobe vboxvfs &> /dev/null einfo " Starting the time syncronization system service" start-stop-daemon --start --make-pidfile \ --exec /usr/sbin/vboxadd-timesync --pidfile /var/run/vboxadd-timesync.pid \ --name vboxadd-timesync \ --background eend $? "Failed to start VirtualBox guest additions" } stop() { ebegin "Stopping VirtualBox guest additions" einfo " Stopping the time syncronization system service" start-stop-daemon --stop --quiet \ --pidfile /var/run/vboxadd-timesync.pid --name vboxadd-timesync einfo " Unloading kernel modules and removing devices" /sbin/rmmod vboxvfs &> /dev/null /sbin/rmmod vboxadd &> /dev/null rm -f /dev/vboxadd &> /dev/null eend $? }