vboxguest.sh revision 79f4c478fc236a59e3638bc01e3df7ae285bd1a9
# Sun xVM VirtualBox
# VirtualBox Guest Additions kernel module control script for FreeBSD.
#
# Copyright (C) 2008 Sun Microsystems, Inc.
#
# 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.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
# Clara, CA 95054 USA or visit http://www.sun.com if you need
# additional information or have any questions.
#
SILENTUNLOAD=""
abort()
{
echo 1>&2 "$1"
exit 1
}
info()
{
echo 1>&2 "$1"
}
{
else
fi
}
{
return 0
fi
abort "VirtualBox kernel module (vboxguest) not installed."
}
{
return 1
fi
return 0
}
{
abort "This program must be run with administrator privileges. Aborting"
fi
}
start()
{
if module_loaded; then
info "vboxguest already loaded..."
else
if ! module_loaded; then
abort "Failed to load vboxguest."
info "Loaded vboxguest."
else
stop
abort "Aborting due to attach failure."
fi
fi
}
stop()
{
if module_loaded; then
info "Unloaded vboxguest."
info "vboxguest not loaded."
fi
}
restart()
{
stop
return 0
}
status()
{
if module_loaded; then
info "vboxguest running."
else
info "vboxguest stopped."
fi
}
if test "$2" = "silentunload"; then
SILENTUNLOAD="$2"
fi
case "$1" in
;;
stop)
stop
;;
;;
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit