vboxguest.sh revision 4b9d6701570cb98fd36e209314239d104ec584d3
45e9809aff7304721fddb95654901b32195c9c7avboxsync# VirtualBox Guest Additions kernel module control script for Solaris.
45e9809aff7304721fddb95654901b32195c9c7avboxsync# Copyright (C) 2008-2010 Oracle Corporation
45e9809aff7304721fddb95654901b32195c9c7avboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
45e9809aff7304721fddb95654901b32195c9c7avboxsync# available from http://www.virtualbox.org. This file is free software;
45e9809aff7304721fddb95654901b32195c9c7avboxsync# you can redistribute it and/or modify it under the terms of the GNU
45e9809aff7304721fddb95654901b32195c9c7avboxsync# General Public License (GPL) as published by the Free Software
45e9809aff7304721fddb95654901b32195c9c7avboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
45e9809aff7304721fddb95654901b32195c9c7avboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
45e9809aff7304721fddb95654901b32195c9c7avboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
45e9809aff7304721fddb95654901b32195c9c7avboxsync# The contents of this file may alternatively be used under the terms
45e9809aff7304721fddb95654901b32195c9c7avboxsync# of the Common Development and Distribution License Version 1.0
45e9809aff7304721fddb95654901b32195c9c7avboxsync# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
45e9809aff7304721fddb95654901b32195c9c7avboxsync# VirtualBox OSE distribution, in which case the provisions of the
45e9809aff7304721fddb95654901b32195c9c7avboxsync# CDDL are applicable instead of those of the GPL.
45e9809aff7304721fddb95654901b32195c9c7avboxsync# You may elect to license modified versions of this file under the
45e9809aff7304721fddb95654901b32195c9c7avboxsync# terms and conditions of either the GPL or the CDDL or both.
45e9809aff7304721fddb95654901b32195c9c7avboxsync abort "VirtualBox kernel module ($MODNAME) NOT installed."
45e9809aff7304721fddb95654901b32195c9c7avboxsync # the reason we don't use "-u" is that some versions of id are old and do not
45e9809aff7304721fddb95654901b32195c9c7avboxsync # support this option (eg. Solaris 10) and do not have a "--version" to check it either
45e9809aff7304721fddb95654901b32195c9c7avboxsync abort "This program must be run with administrator privileges. Aborting"
45e9809aff7304721fddb95654901b32195c9c7avboxsync info "VirtualBox guest kernel module already loaded."
45e9809aff7304721fddb95654901b32195c9c7avboxsync /usr/sbin/add_drv -i'pci80ee,cafe' -m'* 0666 root sys' $MODNAME
45e9809aff7304721fddb95654901b32195c9c7avboxsync if test ! vboxguest_loaded; then
45e9809aff7304721fddb95654901b32195c9c7avboxsync abort "Failed to load VirtualBox guest kernel module."
45e9809aff7304721fddb95654901b32195c9c7avboxsync elif test -c "/devices/pci@0,0/pci80ee,cafe@4:$MODNAME"; then
45e9809aff7304721fddb95654901b32195c9c7avboxsync /usr/sbin/rem_drv $MODNAME || abort "## Failed to unload VirtualBox guest kernel module."
45e9809aff7304721fddb95654901b32195c9c7avboxsync info "VirtualBox FileSystem kernel module already loaded."
45e9809aff7304721fddb95654901b32195c9c7avboxsync /usr/sbin/modload -p fs/$VFSMODNAME || abort "Failed to load VirtualBox FileSystem kernel module."
45e9809aff7304721fddb95654901b32195c9c7avboxsync if test ! vboxfs_loaded; then
45e9809aff7304721fddb95654901b32195c9c7avboxsync abort "Failed to load VirtualBox FileSystem kernel module."
45e9809aff7304721fddb95654901b32195c9c7avboxsync vboxfs_mod_id=`/usr/sbin/modinfo | grep $VFSMODNAME | cut -f 1 -d ' ' `
45e9809aff7304721fddb95654901b32195c9c7avboxsync /usr/sbin/modunload -i $vboxfs_mod_id || abort "Failed to unload VirtualBox FileSystem module."
45e9809aff7304721fddb95654901b32195c9c7avboxsync info "VirtualBox FileSystem kernel module unloaded."
45e9809aff7304721fddb95654901b32195c9c7avboxsync info "VirtualBox FileSystem kernel module not loaded."
if vboxguest_loaded; then