vboxguest.sh revision 9b5e4e8f5c00e8cd2289a73d173c96e551c79397
#
# VirtualBox Guest Additions kernel module control script for Solaris.
#
# Copyright (C) 2008-2010 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.
#
# The contents of this file may alternatively be used under the terms
# of the Common Development and Distribution License Version 1.0
# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
# VirtualBox OSE distribution, in which case the provisions of the
# CDDL are applicable instead of those of the GPL.
#
# You may elect to license modified versions of this file under the
# terms and conditions of either the GPL or the CDDL or both.
#
SILENTUNLOAD=""
MODNAME="vboxguest"
VFSMODNAME="vboxfs"
abort()
{
echo 1>&2 "## $1"
exit 1
}
info()
{
echo 1>&2 "$1"
}
{
fi
return 0
fi
}
{
if test -z "$1"; then
abort "missing argument to module_loaded()"
fi
modname=$1
# modinfo should now work properly since we prevent module autounloading.
return 1
fi
return 0
}
{
return $?
}
{
return $?
}
{
# the reason we don't use "-u" is that some versions of id are old and do not
# support this option (eg. Solaris 10) and do not have a "--version" to check it either
# so go with the uglier but more generic approach
abort "This program must be run with administrator privileges. Aborting"
fi
}
{
if vboxguest_loaded; then
info "VirtualBox guest kernel module already loaded."
else
if test ! vboxguest_loaded; then
abort "Failed to load VirtualBox guest kernel module."
info "VirtualBox guest kernel module loaded."
else
abort "Aborting due to attach failure."
fi
fi
}
{
if vboxguest_loaded; then
info "VirtualBox guest kernel module unloaded."
info "VirtualBox guest kernel module not loaded."
fi
}
{
if vboxfs_loaded; then
info "VirtualBox FileSystem kernel module already loaded."
else
if test ! vboxfs_loaded; then
abort "Failed to load VirtualBox FileSystem kernel module."
else
info "VirtualBox FileSystem kernel module loaded."
fi
fi
}
{
if vboxfs_loaded; then
/usr/sbin/modunload -i $vboxfs_mod_id || abort "Failed to unload VirtualBox FileSystem module."
info "VirtualBox FileSystem kernel module unloaded."
fi
info "VirtualBox FileSystem kernel module not loaded."
fi
}
{
if vboxguest_loaded; then
info "Running."
else
info "Stopped."
fi
}
stop_all()
{
return 0
}
{
return 0
}
if test "$2" = "silentunload"; then
SILENTUNLOAD="$2"
fi
case "$1" in
;;
;;
;;
stop)
;;
;;
;;
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0