installer-utils.sh revision cf0c5109e04ca2939c011edb5ac034987591fd9e
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync# Oracle VM VirtualBox
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync# VirtualBox installer shell routines
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync# Copyright (C) 2007-2011 Oracle Corporation
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync# available from http://www.virtualbox.org. This file is free software;
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync# you can redistribute it and/or modify it under the terms of the GNU
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync# General Public License (GPL) as published by the Free Software
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync# This is used for unit testing and will be reset after the file is sourced for
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync# test runs.
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync echo "KERNEL==\"vboxdrv\", NAME=\"vboxdrv\", OWNER=\"root\", GROUP=\"$VBOXDRV_GRP\", MODE=\"$VBOXDRV_MODE\""
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync echo "SUBSYSTEM==\"usb_device\", ACTION==\"add\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh \$major \$minor \$attr{bDeviceClass}${USB_GROUP}\""
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync echo "SUBSYSTEM==\"usb\", ACTION==\"add\", ENV{DEVTYPE}==\"usb_device\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh \$major \$minor \$attr{bDeviceClass}${USB_GROUP}\""
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync echo "SUBSYSTEM==\"usb_device\", ACTION==\"remove\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh --remove \$major \$minor\""
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync echo "SUBSYSTEM==\"usb\", ACTION==\"remove\", ENV{DEVTYPE}==\"usb_device\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh --remove \$major \$minor\""
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync # install udev rule (disable with INSTALL_NO_UDEV=1 in /etc/default/virtualbox) for distribution packages
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync # To unit test, set $EXTERN to point to a function simulating external
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync # commands: test; which; rm. See the code for usage.
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync VBOXDRV_GRP="$1" # The group owning the vboxdrv device
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync VBOXDRV_MODE="$2" # The access mode for the vboxdrv device
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync INSTALLATION_DIR="$3" # The directory VirtualBox is installed in
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync USB_GROUP="$4" # The group that has permission to access USB devices
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync NO_INSTALL="$5" # Set this to "1" to remove but not re-install rules
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync case "$USB_GROUP" in ?*) USB_GROUP=" $USB_GROUP" ;; esac
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync if [ $? -eq 0 ]; then
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync if [ $? -eq 0 ]; then
5964f60ed7fb52a3c4becbe83c9429f9b2f119c2vboxsync if [ "$udev_ver" = "" -o "$udev_ver" -lt 55 ]; then
if $EXTERN test -f /etc/udev/rules.d/60-vboxdrv.rules; then