[Lunar-commits] r26077 - in moonbase/trunk/x11-utils: . virtualbox virtualbox/init.d

Jannis Pohlmann jannis at lunar-linux.org
Thu Oct 4 15:46:05 CEST 2007


Author: jannis
Date: 2007-10-04 15:46:05 +0200 (Thu, 04 Oct 2007)
New Revision: 26077

Added:
   moonbase/trunk/x11-utils/virtualbox/
   moonbase/trunk/x11-utils/virtualbox/BUILD
   moonbase/trunk/x11-utils/virtualbox/DEPENDS
   moonbase/trunk/x11-utils/virtualbox/DETAILS
   moonbase/trunk/x11-utils/virtualbox/VirtualBox
   moonbase/trunk/x11-utils/virtualbox/init.d/
   moonbase/trunk/x11-utils/virtualbox/init.d/vboxdrv
   moonbase/trunk/x11-utils/virtualbox/init.d/vboxnet
   moonbase/trunk/x11-utils/virtualbox/init.d/virtualbox
Log:
There it is\!

Added: moonbase/trunk/x11-utils/virtualbox/BUILD
===================================================================
--- moonbase/trunk/x11-utils/virtualbox/BUILD	                        (rev 0)
+++ moonbase/trunk/x11-utils/virtualbox/BUILD	2007-10-04 13:46:05 UTC (rev 26077)
@@ -0,0 +1,45 @@
+(
+
+  # We need the qt3 paths
+  . /etc/profile.d/qt3.rc 
+
+  # Substitute hard-coded QTDIR with QTDIR from the qt3 profile
+  sed -i -e 's/QTDIR=.*/QTDIR="$QTDIR"/g' configure &&
+
+  # Build VirtualBox
+  ./configure     &&
+  source ./env.sh &&
+  kmk             &&
+  
+  # Build kernel module 
+  pushd out/linux.x86/release/bin/src &&
+  make &&
+  popd &&
+
+  # Prepare for installation
+  prepare_install &&
+
+  # Create install directory
+  mkdir -p $MODULE_PREFIX &&
+
+  # Install contents of the build directory 
+  cp -R out/linux.x86/release/bin/* $MODULE_PREFIX &&
+
+  # Install kernel module
+  pushd out/linux.x86/release/bin/src &&
+  make install &&
+  popd &&
+
+  # Install the startup script to /usr/bin
+  install -m 755 $SCRIPT_DIRECTORY/VirtualBox /usr/bin &&
+
+  # Substitute $INSTALL_DIR with the module prefix
+  sed -i -e 's:$INSTALL_DIR:'$MODULE_PREFIX':g' /usr/bin/VirtualBox &&
+
+  # Install an empty config file to let VirtualBox know it is installed
+  mkdir -p /etc/vbox && touch /etc/vbox/vbox.cfg &&
+
+  # Create the vboxusers group
+  groupadd -f vboxusers
+
+) > $C_FIFO 2>&1

Added: moonbase/trunk/x11-utils/virtualbox/DEPENDS
===================================================================
--- moonbase/trunk/x11-utils/virtualbox/DEPENDS	                        (rev 0)
+++ moonbase/trunk/x11-utils/virtualbox/DEPENDS	2007-10-04 13:46:05 UTC (rev 26077)
@@ -0,0 +1,9 @@
+depends xalan-c++
+depends iasl
+depends dev86
+depends libxslt
+depends libXcursor
+depends qt3
+depends libIDL
+depends SDL 
+depends alsa-lib

Added: moonbase/trunk/x11-utils/virtualbox/DETAILS
===================================================================
--- moonbase/trunk/x11-utils/virtualbox/DETAILS	                        (rev 0)
+++ moonbase/trunk/x11-utils/virtualbox/DETAILS	2007-10-04 13:46:05 UTC (rev 26077)
@@ -0,0 +1,17 @@
+           MODULE=virtualbox
+    MODULE_PREFIX=${VIRTUALBOX_PREFIX:-/usr/lib/virtualbox/}
+          VERSION=1.5.0
+           SOURCE=VirtualBox-${VERSION}_OSE.tar.bz2
+ SOURCE_DIRECTORY=$BUILD_DIRECTORY/VirtualBox-${VERSION}_OSE
+       SOURCE_URL=http://www.virtualbox.org/download/$VERSION/
+         WEB_SITE=http://virtualbox.org/
+          ENTERED=20071004
+          UPDATED=20071004
+            SHORT="Full virtualizer for x86 hardware"
+
+cat << EOF
+InnoTek VirtualBox is a general-purpose full virtualizer for x86 
+hardware. Targeted at server, desktop and embedded use, it is now 
+the only professional-quality virtualization solution that is also 
+Open Source Software.
+EOF

Added: moonbase/trunk/x11-utils/virtualbox/VirtualBox
===================================================================
--- moonbase/trunk/x11-utils/virtualbox/VirtualBox	                        (rev 0)
+++ moonbase/trunk/x11-utils/virtualbox/VirtualBox	2007-10-04 13:46:05 UTC (rev 26077)
@@ -0,0 +1,116 @@
+#!/bin/sh
+#
+# innotek VirtualBox
+#
+#  Copyright (C) 2006-2007 innotek GmbH
+# 
+#  This file is part of VirtualBox Open Source Edition (OSE), as
+#  available from http://www.virtualbox.org. This file is free software;
+#  you can redistribute it and/or modify it under the terms of the GNU
+#  General Public License 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.
+
+PATH="/usr/bin:/bin:/usr/sbin:/sbin"
+CONFIG="/etc/vbox/vbox.cfg"
+
+if [ ! -r "$CONFIG" ]; then
+    echo "Could not find VirtualBox installation. Please reinstall."
+    exit 1
+fi
+
+. "$CONFIG"
+
+# Note: This script must not fail if the module was not successfully installed
+#       because the user might not want to run a VM but only change VM params!
+
+if [ "$1" = "shutdown" ]; then
+    SHUTDOWN="true"
+elif ! lsmod|grep -q vboxdrv; then
+    cat << EOF
+WARNING: The vboxdrv kernel module is not loaded. Either there is no module
+         available for the current kernel (`uname -r`) or it failed to
+         load. Please recompile the kernel module and install it by
+
+           sudo /etc/init.d/vboxdrv setup
+
+         You will not be able to start VMs until this problem is fixed.
+EOF
+elif [ ! -c /dev/vboxdrv ]; then
+    cat << EOF
+WARNING: The character device /dev/vboxdrv does not exist. Try
+
+           sudo /etc/init.d/virtualbox restart
+
+         and if that is not successful, try to re-install the package.
+
+	 You will not be able to start VMs until this problem is fixed.
+EOF
+elif [ ! -w /dev/vboxdrv ]; then
+    if [ "`id | grep vboxusers`" = "" ]; then
+        cat << EOF
+WARNING: You are not a member of the "vboxusers" group.  Please add yourself
+         to this group before starting VirtualBox.
+
+	 You will not be able to start VMs until this problem is fixed.
+EOF
+    else
+        cat << EOF
+WARNING: /dev/vboxdrv not writable for some reason. If you recently added the
+         current user to the vboxusers group then you have to logout and
+	 re-login to take the change effect.
+
+	 You will not be able to start VMs until this problem is fixed.
+EOF
+    fi
+fi
+
+if [ -f /etc/vbox/module_not_compiled ]; then
+    cat << EOF
+WARNING: The compilation of the vboxdrv.ko kernel module failed during the
+         installation for some reason. Starting a VM will not be possible.
+         Please consult the User Manual for build instructions.
+EOF
+fi
+
+export LD_LIBRARY_PATH="$INSTALL_DIR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
+
+SERVER_PID=`ps -U \`whoami\` | grep VBoxSVC | awk '{ print $1 }'`
+if [ -z "$SERVER_PID" ]; then
+    # Server not running yet/anymore, cleanup socket path.
+    # See IPC_GetDefaultSocketPath()!
+    if [ -n "$LOGNAME" ]; then
+        rm -rf /tmp/.vbox-$LOGNAME-ipc > /dev/null 2>&1
+    else
+        rm -rf /tmp/.vbox-$USER-ipc > /dev/null 2>&1
+    fi
+fi
+
+if [ "$SHUTDOWN" = "true" ]; then
+    if [ -n "$SERVER_PID" ]; then
+        kill -TERM $SERVER_PID
+        sleep 2
+    fi
+    exit 0
+fi
+
+APP=`which $0`
+APP=${APP##/*/}
+case "$APP" in
+  VirtualBox)
+    exec "$INSTALL_DIR/VirtualBox" "$@"
+  ;;
+  VBoxManage)
+    exec "$INSTALL_DIR/VBoxManage" "$@"
+  ;;
+  VBoxSDL)
+    exec "$INSTALL_DIR/VBoxSDL" "$@"
+  ;;
+  VBoxVRDP)
+    exec "$INSTALL_DIR/VBoxVRDP" "$@"
+  ;;
+  *)
+    echo "Unknown application - $APP"
+  ;;
+esac


Property changes on: moonbase/trunk/x11-utils/virtualbox/VirtualBox
___________________________________________________________________
Name: svn:executable
   + *

Added: moonbase/trunk/x11-utils/virtualbox/init.d/vboxdrv
===================================================================
--- moonbase/trunk/x11-utils/virtualbox/init.d/vboxdrv	                        (rev 0)
+++ moonbase/trunk/x11-utils/virtualbox/init.d/vboxdrv	2007-10-04 13:46:05 UTC (rev 26077)
@@ -0,0 +1,229 @@
+#! /bin/sh
+# innotek VirtualBox
+# Linux kernel module init script
+
+#
+#  Copyright (C) 2006-2007 innotek GmbH
+# 
+#  This file is part of VirtualBox Open Source Edition (OSE), as
+#  available from http://www.virtualbox.org. This file is free software;
+#  you can redistribute it and/or modify it under the terms of the GNU
+#  General Public License 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: 35 30 60
+# description: VirtualBox Linux kernel module
+#
+### BEGIN INIT INFO
+# Provides:       vboxdrv
+# Required-Start: $syslog
+# Required-Stop:
+# Default-Start:  3 5
+# Default-Stop:
+# Description:    VirtualBox Linux kernel module
+### END INIT INFO
+
+PATH=$PATH:/bin:/sbin:/usr/sbin
+CONFIG="/etc/vbox/vbox.cfg"
+
+if [ -f /etc/redhat-release ]; then
+    system=redhat
+elif [ -f /etc/SuSE-release ]; then
+    system=suse
+elif [ -f /etc/gentoo-release ]; then
+    system=gentoo
+else
+    system=other
+fi
+
+if [ "$system" = "redhat" ]; then
+    . /etc/init.d/functions
+    fail_msg() {
+        echo_failure
+        echo
+    }
+
+    succ_msg() {
+        echo_success
+        echo
+    }
+
+    begin() {
+        echo -n "$1"
+    }
+fi
+
+if [ "$system" = "suse" ]; then
+    . /etc/rc.status
+    fail_msg() {
+        rc_failed 1
+        rc_status -v
+    }
+
+    succ_msg() {
+        rc_reset
+        rc_status -v
+    }
+
+    begin() {
+        echo -n "$1"
+    }
+fi
+
+if [ "$system" = "gentoo" ]; then
+    . /sbin/functions.sh
+    fail_msg() {
+        eend 1
+    }
+
+    succ_msg() {
+        eend $?
+    }
+
+    begin() {
+        ebegin $1
+    }
+
+    if [ "`which $0`" = "/sbin/rc" ]; then
+        shift
+    fi
+fi
+
+if [ "$system" = "other" ]; then
+    fail_msg() {
+        echo " ...fail!"
+    }
+
+    succ_msg() {
+        echo " ...done."
+    }
+
+    begin() {
+        echo -n $1
+    }
+fi
+
+
+kdir=/lib/modules/`uname -r`/misc
+dev=/dev/vboxdrv
+modname=vboxdrv
+groupname=vboxusers
+
+fail() {
+    if [ "$system" = "gentoo" ]; then
+        eerror $1
+        exit 1
+    fi
+    fail_msg
+    echo "($1)"
+    exit 1
+}
+
+running() {
+    lsmod | grep -q $modname[^_-]
+}
+
+start() {
+    begin "Starting VirtualBox kernel module "
+    test -f "$kdir/$modname.o" -o -f "$kdir/$modname.ko" || {
+        fail "Kernel module not found"
+    }
+    running || {
+        rm -f $dev || {
+            fail "Cannot remove $dev"
+        }
+
+        modprobe $modname || {
+            fail "modprobe $modname failed"
+        }
+
+        sleep 1
+    }
+    if [ ! -c $dev ]; then
+        maj=`sed -n 's;\([0-9]\+\) vboxdrv;\1;p' /proc/devices`
+        if [ ! -z "$maj" ]; then
+            min=0
+        else
+            min=`sed -n 's;\([0-9]\+\) vboxdrv;\1;p' /proc/misc`
+            if [ ! -z "$min" ]; then
+                maj=10
+            fi
+        fi
+        test -z "$maj" && {
+            rmmod $modname
+            fail "Cannot locate the VirtualBox device"
+        }
+
+        mknod -m 0664 $dev c $maj $min || {
+            rmmod $modname
+            fail "Cannot create device $dev with major $maj and minor $min"
+        }
+    fi
+
+    chown :$groupname $dev || {
+        rmmod $modname
+        fail "Cannot change owner $groupname for device $dev"
+    }
+
+    succ_msg
+    return 0
+}
+
+stop() {
+    begin "Stopping VirtualBox kernel module "
+    if running; then
+        rmmod $modname || fail "Cannot unload module $modname"
+        rm -f $dev || fail "Cannot unlink $dev"
+    fi
+    succ_msg
+    return 0
+}
+
+restart() {
+    stop && start
+    return 0
+}
+
+setup() {
+    . "$CONFIG"
+    stop
+    begin "Recompiling VirtualBox kernel module "
+    if ! $INSTALL_DIR/src/build_in_tmp install > /var/log/vbox-install.log 2>&1; then
+        fail "Look at /var/log/vbox-install.log to find out what went wrong"
+    fi
+    succ_msg
+    start
+}
+
+dmnstatus() {
+    if running; then
+        echo "VirtualBox kernel module is loaded."
+    else
+        echo "VirtualBox kernel module is not loaded."
+    fi
+}
+
+case "$1" in
+start)
+    start
+    ;;
+stop)
+    stop
+    ;;
+restart)
+    restart
+    ;;
+setup)
+    setup
+    ;;
+status)
+    dmnstatus
+    ;;
+*)
+    echo "Usage: $0 {start|stop|restart|status|setup}"
+    exit 1
+esac
+
+exit


Property changes on: moonbase/trunk/x11-utils/virtualbox/init.d/vboxdrv
___________________________________________________________________
Name: svn:executable
   + *

Added: moonbase/trunk/x11-utils/virtualbox/init.d/vboxnet
===================================================================
--- moonbase/trunk/x11-utils/virtualbox/init.d/vboxnet	                        (rev 0)
+++ moonbase/trunk/x11-utils/virtualbox/init.d/vboxnet	2007-10-04 13:46:05 UTC (rev 26077)
@@ -0,0 +1,400 @@
+#! /bin/sh
+# innotek VirtualBox
+# Linux static host networking interface initialization
+#
+
+#
+#  Copyright (C) 2007 innotek GmbH
+# 
+#  This file is part of VirtualBox Open Source Edition (OSE), as
+#  available from http://www.virtualbox.org. This file is free software;
+#  you can redistribute it and/or modify it under the terms of the GNU
+#  General Public License 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: 35 30 60
+# description: VirtualBox permanent host networking setup
+#
+### BEGIN INIT INFO
+# Provides:       vboxnet
+# Required-Start: $network
+# Required-Stop:
+# Default-Start:  3 5
+# Default-Stop:
+# Description:    VirtualBox permanent host networking setup
+### END INIT INFO
+
+PATH=$PATH:/bin:/sbin:/usr/sbin
+CONFIG="/etc/vbox/interfaces"
+VARDIR="/var/run/VirtualBox"
+VARFILE="/var/run/VirtualBox/vboxnet"
+TAPDEV="/dev/net/tun"
+
+if [ -f /etc/redhat-release ]; then
+    system=redhat
+elif [ -f /etc/SuSE-release ]; then
+    system=suse
+elif [ -f /etc/gentoo-release ]; then
+    system=gentoo
+else
+    system=other
+fi
+
+if [ "$system" = "redhat" ]; then
+    . /etc/init.d/functions
+    fail_msg() {
+        echo_failure
+        echo
+    }
+
+    succ_msg() {
+        echo_success
+        echo
+    }
+
+    begin() {
+        echo -n "$1"
+    }
+fi
+
+if [ "$system" = "suse" ]; then
+    . /etc/rc.status
+    fail_msg() {
+        rc_failed 1
+        rc_status -v
+    }
+
+    succ_msg() {
+        rc_reset
+        rc_status -v
+    }
+
+    begin() {
+        echo -n "$1"
+    }
+fi
+
+if [ "$system" = "gentoo" ]; then
+    . /sbin/functions.sh
+    fail_msg() {
+        eend 1
+    }
+
+    succ_msg() {
+        eend $?
+    }
+
+    begin() {
+        ebegin $1
+    }
+
+    if [ "`which $0`" = "/sbin/rc" ]; then
+        shift
+    fi
+fi
+
+if [ "$system" = "other" ]; then
+    fail_msg() {
+        echo " ...fail!"
+    }
+
+    succ_msg() {
+        echo " ...done."
+    }
+
+    begin() {
+        echo -n $1
+    }
+fi
+
+fail() {
+    if [ "$system" = "gentoo" ]; then
+        eerror $1
+        exit 1
+    fi
+    fail_msg
+    echo "($1)"
+    exit 1
+}
+
+running() {
+    test -f "$VARFILE"
+}
+
+valid_ifname() {
+    if expr match "$1" "vbox[0-9][0-9]*$" > /dev/null 2>&1
+    then
+      return 0
+    else
+      return 1
+    fi
+}
+
+# Create all permanent TAP devices registered on the system, add them to a
+# bridge if required and keep a record of proceedings in the file
+# /var/run/VirtualBox/vboxnet.  If this file already exists, assume that the
+# script has already been started and do nothing.
+start_network() {
+    begin "Starting VirtualBox host networking"
+    # If the service is already running, return successfully.
+    if [ -f "$VARFILE" ]
+    then
+      succ_msg
+      return 0
+    fi
+    # Fail if we can't create our runtime record file
+    if [ ! -d "$VARDIR" ]
+    then
+      if ! mkdir "$VARDIR" 2> /dev/null
+      then
+        fail_msg
+        return 1
+      fi
+    fi
+    if ! touch "$VARFILE" 2> /dev/null
+    then
+      fail_msg
+      return 1
+    fi
+    # If there is no configuration file, report success
+    if [ ! -f "$CONFIG" ]
+    then
+      succ_msg
+      return 0
+    fi
+    # Fail if we can't read our configuration
+    if [ ! -r "$CONFIG" ]
+    then
+      fail_msg
+      return 1
+    fi
+    # Fail if we don't have tunctl
+    if ! VBoxTunctl -h 2>&1 | grep VBoxTunctl > /dev/null
+    then
+      fail_msg
+      return 1
+    fi
+    succ_msg
+    # Read the configuration file entries line by line and create the
+    # interfaces
+    while read line
+    do
+      set ""$line
+      # If the line is a comment then ignore it
+      if ((! expr match "$1" "#" > /dev/null) && (! test -z "$1"))
+      then
+        # Check that the line is correctly formed (an interface name plus one
+        # or two non-comment entries, possibly followed by a comment).
+        if ((! expr match "$2" "#" > /dev/null) &&
+            (test -z "$4" || expr match "$4" "#" > /dev/null) &&
+            (valid_ifname "$1"))
+        then
+          # Try to create the interface
+          if VBoxTunctl -t "$1" -u "$2" > /dev/null 2>&1
+          then
+            # On SUSE Linux Enterprise Server, the interface does not
+            # appear immediately, so we loop trying to bring it up.
+            i=1
+            while [ $i -le 10 ]
+            do
+              ifconfig "$1" up 2> /dev/null
+              if ifconfig | grep "$1" > /dev/null 2>&1
+              then
+                # Add the interface to a bridge if one was specified
+                if [ ! -z "$3" ]
+                then
+                  if brctl addif "$3" "$1" 2> /dev/null
+                  then
+                    echo "$1 $2 $3" > "$VARFILE"
+                  else
+                    echo "$1 $2" > "$VARFILE"
+                    echo "Warning - failed to add interface $1 to the bridge $3"
+                  fi
+                else
+                  echo "$1 $2" > $VARFILE
+                fi
+                i=20
+              else
+                i=`expr $i + 1`
+                sleep .1
+              fi
+            done
+            if [ $i -ne 20 ]
+            then
+              echo "Warning - failed to bring up the interface $1"
+            fi
+          else
+            echo "Warning - failed to create the interface $1 for the user $2"
+          fi
+        else
+          echo "Warning - invalid line in $CONFIG:"
+          echo "  $line"
+        fi
+      fi
+    done < "$CONFIG"
+    # Set /dev/net/tun to belong to the group vboxusers if it exists and does
+    # yet belong to a group.
+    if ls -g "$TAPDEV" 2>/dev/null | grep root
+    then
+      chgrp vboxusers "$TAPDEV"
+      chmod 0660 "$TAPDEV"
+    fi
+    return 0
+}
+
+# Shut down VirtualBox host networking and remove all permanent TAP
+# interfaces.  This action will fail if some interfaces could not be removed.
+stop_network() {
+    begin "Shutting down VirtualBox host networking"
+    # If there is no runtime record file, assume that the service is not
+    # running.
+    if [ ! -f "$VARFILE" ]
+    then
+      succ_msg
+      return 0
+    fi
+    # Fail if we can't read our runtime record file or write to the
+    # folder it is located in
+    if [ ! -r "$VARFILE" -o ! -w "$VARDIR" ]
+    then
+      fail_msg
+      return 1
+    fi
+    # Fail if we don't have tunctl
+    if ! VBoxTunctl -h 2>&1 | grep VBoxTunctl > /dev/null
+    then
+      fail_msg
+      return 1
+    fi
+    # Read the runtime record file entries line by line and delete the
+    # interfaces.  The format of the runtime record file is not checked for
+    # errors.
+    while read line
+    do
+      set ""$line
+      # Remove the interface from a bridge if it is part of one
+      if [ ! -z "$3" ]
+      then
+        brctl delif "$3" "$1" 2> /dev/null
+      fi
+      # Remove the interface.  Roll back everything and fail if this is not
+      # possible
+      if (! ifconfig "$1" down 2> /dev/null ||
+          ! VBoxTunctl -d "$1" > /dev/null 2>&1)
+      then
+        while read line
+        do
+          set ""$line
+          VBoxTunctl -t "$1" -u "$2" > /dev/null 2>&1
+          ifconfig "$1" up 2> /dev/null
+          if [ ! -z "$3" ]
+          then
+            brctl addif "$3" "$1"
+          fi
+        done < "$VARFILE"
+        fail_msg
+        return 1
+      fi
+    done < "$VARFILE"
+    rm -f "$VARFILE" 2> /dev/null
+    succ_msg
+    return 0
+}
+
+# Shut down VirtualBox host networking and remove all permanent TAP
+# interfaces.  This action will succeed even if not all interfaces could be
+# removed.  It is only intended for exceptional circumstances such as
+# uninstalling VirtualBox.
+force_stop_network() {
+    begin "Shutting down VirtualBox host networking"
+    # If there is no runtime record file, assume that the service is not
+    # running.
+    if [ ! -f "$VARFILE" ]
+    then
+      succ_msg
+      return 0
+    fi
+    # Fail if we can't read our runtime record file or write to the
+    # folder it is located in
+    if [ ! -r "$VARFILE" -o ! -w "$VARDIR" ]
+    then
+      fail_msg
+      return 1
+    fi
+    # Fail if we don't have tunctl
+    if ! VBoxTunctl -h 2>&1 | grep VBoxTunctl > /dev/null
+    then
+      fail_msg
+      return 1
+    fi
+    # Read the runtime record file entries line by line and delete the
+    # interfaces.  The format of the runtime record file is not checked for
+    # errors.
+    while read line
+    do
+      set ""$line
+      # Remove the interface from a bridge if it is part of one
+      if [ ! -z "$3" ]
+      then
+        brctl delif "$3" "$1" 2> /dev/null
+      fi
+      # Remove the interface.
+      ifconfig "$1" down 2> /dev/null
+      VBoxTunctl -d "$1" > /dev/null 2>&1
+    done < "$VARFILE"
+    rm -f "$VARFILE" 2> /dev/null
+    succ_msg
+    return 0
+}
+
+start() {
+    start_network
+}
+
+stop() {
+    stop_network
+}
+
+force_stop() {
+    force_stop_network
+}
+
+restart() {
+    stop_network && start_network
+}
+
+status() {
+    if running; then
+        echo "VirtualBox host networking is loaded."
+    else
+        echo "VirtualBox host networking is not loaded."
+    fi
+}
+
+case "$1" in
+start)
+    start
+    ;;
+stop)
+    stop
+    ;;
+restart)
+    restart
+    ;;
+force-reload)
+    restart
+    ;;
+force-stop)
+    force_stop
+    ;;
+status)
+    status
+    ;;
+*)
+    echo "Usage: `basename $0` {start|stop|restart|force-reload|status}"
+    exit 1
+esac
+
+exit


Property changes on: moonbase/trunk/x11-utils/virtualbox/init.d/vboxnet
___________________________________________________________________
Name: svn:executable
   + *

Added: moonbase/trunk/x11-utils/virtualbox/init.d/virtualbox
===================================================================
--- moonbase/trunk/x11-utils/virtualbox/init.d/virtualbox	                        (rev 0)
+++ moonbase/trunk/x11-utils/virtualbox/init.d/virtualbox	2007-10-04 13:46:05 UTC (rev 26077)
@@ -0,0 +1,43 @@
+#!/bin/bash
+#
+# Startup script for VirtualBox
+#
+# chkconfig:   345 50 50
+# description: Initializes VirtualBox
+# short:       VirtualBox
+
+load_kernel_module () {
+  modprobe vboxdrv
+}
+
+unload_kernel_module () {
+  rmmod vboxdrv
+}
+
+set_permissions () {
+  chgrp vboxusers /dev/vboxdrv &&
+  chmod g+rwx /dev/vboxdrv
+}
+
+start () {
+  echo -n "Starting VirtualBox: "
+  load_kernel_module && set_permissions
+  if [ $? == 0 ]; then
+    echo -e $RESULT_OK
+  else
+    echo -e $RESULT_FAIL
+  fi
+}
+
+stop () {
+  echo -n "Stopping VirtualBox: "
+  unload_kernel_module
+  echo -e $RESULT_OK
+}
+
+restart () {
+  stop
+  start
+}
+
+. /lib/lsb/init-functions


Property changes on: moonbase/trunk/x11-utils/virtualbox/init.d/virtualbox
___________________________________________________________________
Name: svn:executable
   + *



More information about the Lunar-commits mailing list