vboxadd.sh revision e64031e20c39650a7bc902a3e1aba613b9415dee
# Sun VirtualBox
# Linux Additions kernel module init script ($Revision$)
#
#
# Copyright (C) 2006-2009 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
# chkconfig: 357 30 70
# description: VirtualBox Linux Additions kernel modules
#
### BEGIN INIT INFO
# Provides: vboxadd
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: VirtualBox Linux Additions kernel modules
### END INIT INFO
fi
# Check architecture
cpu="x86"
;;
cpu="amd64"
else
fi
;;
esac
if [ -f /etc/arch-release ]; then
elif [ -f /etc/redhat-release ]; then
elif [ -f /etc/SuSE-release ]; then
elif [ -f /etc/gentoo-release ]; then
else
fi
if [ "$system" = "arch" ]; then
}
}
stat_busy "$1"
}
fi
if [ "$system" = "redhat" ]; then
echo
}
echo
}
echo -n "$1"
}
fi
if [ "$system" = "suse" ]; then
rc_status -v
}
rc_status -v
}
echo -n "$1"
}
fi
if [ "$system" = "gentoo" ]; then
if [ -f /sbin/functions.sh ]; then
. /sbin/functions.sh
fi
eend 1
}
eend $?
}
ebegin $1
}
shift
fi
fi
if [ "$system" = "lfs" ]; then
}
}
echo $1
}
fi
if [ "$system" = "other" ]; then
echo " ...fail!"
}
echo " ...done."
}
echo -n $1
}
fi
group=1
fail()
{
eerror $1
exit 1
fi
echo "($1)"
exit 1
}
{
}
{
}
{
}
start()
{
running_vboxguest || {
}
}
fail "modprobe vboxguest failed"
}
sleep .5
}
if [ ! -c $dev ]; then
min=0
else
maj=10
fi
fi
fail "Cannot locate the VirtualBox device"
}
}
fi
}
if [ ! -c $userdev ]; then
maj=10
}
}
fi
fi
running_vboxvfs || {
echo "Unable to start shared folders support. Make sure that your VirtualBox build"
echo "supports this feature."
exit 1
fi
fail "modprobe vboxvfs failed"
}
}
fi
# other startup script but this requires the vboxdrv kernel module loaded.
return 0
}
stop()
{
fail "Cannot unmount vboxsf folders"
fi
if running_vboxvfs; then
fi
fi
if running_vboxguest; then
fi
return 0
}
restart()
{
stop && start
return 0
}
# setup_script
setup()
{
# don't stop the old modules here -- they might be in use
begin "Removing old VirtualBox vboxvideo kernel module"
fi
begin "Removing old VirtualBox vboxvfs kernel module"
fi
begin "Removing old VirtualBox vboxguest kernel module"
fi
begin "Building the VirtualBox Guest Additions kernel modules"
fail "`printf "Your system does not seem to be set up to build kernel modules.\nLook at $LOG to find out what went wrong"`"
fi
echo
printf "\nYour guest system does not seem to have sufficient OpenGL support to enable\naccelerated 3D effects (this requires Linux 2.6.27 or later in the guest\nsystem). This Guest Additions feature will be disabled.\n\n"
fi
begin "Building the main Guest Additions module"
if ! $BUILDVBOXGUEST \
fi
begin "Building the shared folder support module"
if ! $BUILDVBOXVFS \
--use-module-symvers /tmp/vboxguest-Module.symvers \
fi
fi
begin "Building the OpenGL support module"
if ! $BUILDVBOXVIDEO \
--use-module-symvers /tmp/vboxguest-Module.symvers \
fi
fi
begin "Doing non-kernel setup of the Guest Additions"
# This is the LSB version of useradd and should work on recent
# distributions
# And for the others, we choose a UID ourselves
# Create udev description file
udev_call=""
if [ $? -eq 0 ]; then
else
if [ $? -eq 0 ]; then
fi
fi
udev_fix="="
if [ "${udev_call}" != "" ]; then
udev_fix=""
fi
fi
## @todo 60-vboxadd.rules -> 60-vboxguest.rules ?
echo "KERNEL=${udev_fix}\"vboxguest\", NAME=\"vboxguest\", OWNER=\"vboxadd\", MODE=\"0660\"" > /etc/udev/rules.d/60-vboxadd.rules
echo "KERNEL=${udev_fix}\"vboxuser\", NAME=\"vboxuser\", OWNER=\"vboxadd\", MODE=\"0666\"" >> /etc/udev/rules.d/60-vboxadd.rules
fi
# Put mount.vboxsf in the right place
# At least Fedora 11 and Fedora 12 demand on the correct security context when
# executing this command from service scripts. Shouldn't hurt for other distributions.
if running_vboxguest || running_vboxadd; then
printf "You should restart your guest to make sure the new modules are actually used\n\n"
else
fi
}
# cleanup_script
cleanup()
{
# Delete old versions of VBox modules.
echo "Attempt to remove old DKMS modules..."
fi
done
done
echo "Done."
fi
# Remove old installed modules
# Remove old module sources
# Remove other files
rm /sbin/mount.vboxsf 2>/dev/null
}
{
if running_vboxguest; then
echo "The VirtualBox Additions are currently running."
else
echo "The VirtualBox Additions are not currently running."
fi
}
case "$1" in
;;
stop)
stop
;;
;;
;;
;;
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit