vboxvfs.sh revision da5293b4b0422bf0a8cf0a3018144cf2f56cf855
2521N/A#! /bin/sh
2521N/A# InnoTek VirtualBox
2521N/A# Linux Additions VFS kernel module init script
2521N/A#
2521N/A# Copyright (C) 2006 InnoTek Systemberatung GmbH
2521N/A#
2521N/A# This file is part of VirtualBox Open Source Edition (OSE), as
2521N/A# available from http://www.virtualbox.org. This file is free software;
2521N/A# you can redistribute it and/or modify it under the terms of the GNU
2521N/A# General Public License as published by the Free Software Foundation,
2521N/A# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
2521N/A# distribution. VirtualBox OSE is distributed in the hope that it will
2521N/A# be useful, but WITHOUT ANY WARRANTY of any kind.
2521N/A#
2521N/A# If you received this file as part of a commercial VirtualBox
2521N/A# distribution, then only the terms of your commercial VirtualBox
2521N/A# license agreement apply instead of the previous paragraph.
2521N/A
2521N/A
2521N/A# chkconfig: 35 30 60
2521N/A# description: VirtualBox Linux Additions VFS kernel module
2521N/A#
5403N/A### BEGIN INIT INFO
2521N/A# Provides: vboxvfs
3998N/A# Required-Start: $syslog vboxadd
2521N/A# Required-Stop:
3998N/A# Default-Start: 3 5
3998N/A# Default-Stop:
2521N/A# Description: VirtualBox Linux Additions VFS kernel module
5403N/A### END INIT INFO
5403N/A
5403N/APATH=$PATH:/bin:/sbin:/usr/sbin
2521N/A
2521N/Asystem=unknown
2521N/Aif [ -f /etc/redhat-release ]; then
5403N/A system=redhat
2521N/Aelif [ -f /etc/SuSE-release ]; then
3533N/A system=suse
2521N/Aelif [ -f /etc/debian_version ]; then
3998N/A system=debian
3998N/Aelif [ -f /etc/gentoo-release ]; then
3998N/A system=gentoo
5403N/Aelif [ -f /etc/slackware-version ]; then
3998N/A system=slackware
5403N/Aelse
5403N/A echo "$0: Unknown system" 1>&2
3998N/Afi
3998N/A
3998N/Aif [ "$system" = redhat ]; then
5403N/A . /etc/init.d/functions
3998N/A fail_msg() {
3998N/A echo_failure
3998N/A echo
3998N/A }
3998N/A
3998N/A succ_msg() {
3998N/A echo_success
5403N/A echo
3998N/A }
5403N/A
3998N/A begin() {
5403N/A echo -n $1
5403N/A }
5403N/Afi
3998N/A
3998N/Aif [ "$system" = suse ]; then
3998N/A . /etc/rc.status
3998N/A fail_msg() {
3998N/A rc_failed 1
3998N/A rc_status -v
4194N/A }
3998N/A
3998N/A succ_msg() {
3998N/A rc_reset
3998N/A rc_status -v
3998N/A }
3998N/A
3998N/A begin() {
4194N/A echo -n $1
4194N/A }
3998N/Afi
3998N/A
3998N/Aif [ "$system" = debian ]; then
3998N/A fail_msg() {
3998N/A echo "...fail!"
3998N/A }
4194N/A
4194N/A succ_msg() {
3998N/A echo "...done."
3998N/A }
3998N/A
5425N/A begin() {
3998N/A echo -n $1
3998N/A }
3998N/Afi
4194N/A
4194N/Aif [ "$system" = gentoo ]; then
3998N/A . /sbin/functions.sh
3998N/A fail_msg() {
3998N/A eend 1
5425N/A }
3998N/A
3998N/A succ_msg() {
3998N/A eend $?
4194N/A }
4194N/A
3998N/A begin() {
3998N/A ebegin $1
3998N/A }
5425N/A
2521N/A if [ "`which $0`" = "/sbin/rc" ]; then
3998N/A shift
3998N/A fi
4194N/Afi
4194N/A
3998N/Aif [ "$system" = slackware ]; then
3998N/A fail_msg() {
3998N/A echo "...fail!"
5425N/A }
3998N/A
3998N/A succ_msg() {
5403N/A echo "...done."
4194N/A }
4194N/A
3998N/A begin() {
5403N/A echo -n $1
3998N/A }
5425N/Afi
3998N/A
3998N/Akdir=/lib/modules/`uname -r`/misc
3998N/Amodname=vboxvfs
4194N/Amodule="$kdir/$modname"
4194N/A
3998N/Afile=""
3998N/Atest -f $module.o && file=$module.o
3998N/Atest -f $module.ko && file=$module.ko
5425N/A
3998N/Afail() {
3998N/A if [ "$system" = gentoo ]; then
3998N/A eerror $1
4194N/A exit 1
4194N/A fi
3998N/A echo -n "($1)"
3998N/A fail_msg
3998N/A exit 1
5425N/A}
3998N/A
3998N/Atest -z "$file" && {
3998N/A fail "Kernel module not found"
4194N/A}
4194N/A
3998N/Arunning() {
3998N/A lsmod | grep -q $modname[^_-]
3998N/A}
5425N/A
3998N/Astart() {
3998N/A begin "Starting VirtualBox Additions shared folder support";
3998N/A running || {
4194N/A modprobe $modname || {
4194N/A fail "modprobe $modname failed"
3998N/A }
3998N/A }
3998N/A succ_msg
5425N/A return 0
3998N/A}
3998N/A
3998N/Astop() {
4194N/A begin "Stopping VirtualBox Additions shared folder support";
4194N/A if running; then
3998N/A rmmod $modname || fail "Cannot unload module $modname"
3998N/A fi
3998N/A succ_msg
5425N/A return 0
3998N/A}
3998N/A
3998N/Arestart() {
4194N/A stop && start
4194N/A return 0
3998N/A}
3998N/A
3998N/Admnstatus() {
5425N/A if running; then
3998N/A echo "VirtualBox Additions shared folder support is currently running."
3998N/A else
3998N/A echo "VirtualBox Additions shared folder support is not currently running."
4194N/A fi
4194N/A}
3998N/A
3998N/Acase "$1" in
3998N/Astart)
5425N/A start
3998N/A ;;
3998N/Astop)
3998N/A stop
4194N/A ;;
4194N/Arestart)
3998N/A restart
3998N/A ;;
3998N/Astatus)
5425N/A dmnstatus
3998N/A ;;
3998N/A*)
3998N/A echo "Usage: $0 {start|stop|restart|status}"
4194N/A exit 1
4194N/Aesac
3998N/A
3998N/Aexit
3998N/A