loadall.sh revision 09be92438e241f8528a68e84e8752ca17558d37c
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#!/bin/bash
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync## @file
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# For development, builds and loads all the host drivers.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# Copyright (C) 2010-2011 Oracle Corporation
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# available from http://www.virtualbox.org. This file is free software;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# you can redistribute it and/or modify it under the terms of the GNU
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# General Public License (GPL) as published by the Free Software
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncMY_DIR=`cd "${0}/.." && cmd /c cd | kmk_sed -e 's,\\\\,/,g' `
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncif [ ! -d "${MY_DIR}" ]; then
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync echo "Cannot find ${MY_DIR} or it's not a directory..."
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync exit 1;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncfi
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncecho MY_DIR=$MY_DIR
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# Stop all VBox drivers.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncfor drv in VBoxNetAdp VBoxNetFlt VBoxUSBMon VBoxUSB VBoxDrv;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncdo
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync if sc query $drv > /dev/null; then
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync STATE=`sc query $drv \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync | kmk_sed -e '/^ *STATE /!d' -e 's/^[^:]*: [0-9 ]*//' \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync -e 's/ */ /g' \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync -e 's/^ *//g' \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync -e 's/ *$//g' \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync `
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync echo "dbg: drv=$drv state=$STATE"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync case "$STATE" in
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync "STOPPED")
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync # Do nothing.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ;;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync *)
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync echo "Stopping $drv..."
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync sc stop $drv
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ;;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync esac
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fi
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncdone
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncset -e
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncset -x
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# Invoke the uninstallers.
#
for uninst in NetAdpUninstall.exe NetFltUninstall.exe USBUninstall.exe SUPUninstall.exe;
do
if test -f ${MY_DIR}/$uninst; then
${MY_DIR}/$uninst
fi
done
exit 1
#
# Invoke the installers.
#
for inst in NetAdpInstall.exe NetFltInstall.exe USBInstall.exe SUPInstall.exe;
do
if test -f ${MY_DIR}/$inst; then
${MY_DIR}/$inst
fi
done