installer-utils.sh revision 45c2de093cddc990b8d1583aa49b9a40de7a3d97
# Oracle VM VirtualBox
# VirtualBox installer shell routines
#
# Copyright (C) 2007-2011 Oracle Corporation
#
# 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.
#
## @todo Make this file into a script in the VirtualBox lib directory once
# enough code has been made shared between the different installers.
# This is used for unit testing and will be reset after the file is sourced for
# test runs.
unset EXTERN
VBOXDRV_GRP="$1"
VBOXDRV_MODE="$2"
echo "KERNEL==\"vboxdrv\", NAME=\"vboxdrv\", OWNER=\"root\", GROUP=\"$VBOXDRV_GRP\", MODE=\"$VBOXDRV_MODE\""
}
INSTALLATION_DIR="$1"
USB_GROUP="$2"
echo "SUBSYSTEM==\"usb_device\", ACTION==\"add\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh \$major \$minor \$attr{bDeviceClass}${USB_GROUP}\""
echo "SUBSYSTEM==\"usb\", ACTION==\"add\", ENV{DEVTYPE}==\"usb_device\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh \$major \$minor \$attr{bDeviceClass}${USB_GROUP}\""
echo "SUBSYSTEM==\"usb_device\", ACTION==\"remove\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh --remove \$major \$minor\""
echo "SUBSYSTEM==\"usb\", ACTION==\"remove\", ENV{DEVTYPE}==\"usb_device\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh --remove \$major \$minor\""
}
# install udev rule (disable with INSTALL_NO_UDEV=1 in /etc/default/virtualbox) for distribution packages
# To unit test, set $EXTERN to point to a function simulating external
# commands: test; which; rm. See the code for usage.
# Extra space!
"1") ;;
*)
udev_call=""
if [ $? -eq 0 ]; then
else
if [ $? -eq 0 ]; then
fi
fi
udev_fix=""
if [ "${udev_call}" != "" ]; then
udev_fix="1"
fi
udev_do_usb=""
udev_do_usb="1"
fi
fi
"1")
sed 's/\([^+=]*\)[+=]*\([^"]*"[^"]*"\)/\1=\2/g'
;;
*)
esac
;;
esac
fi
;;
esac
# Remove old udev description file
if $EXTERN test -f /etc/udev/rules.d/60-vboxdrv.rules; then
fi
}
# install_udev.
# Create a usb device node for a given sysfs path
fi
}
# install_device_node_setup contains some aliases for unit testing purposes. # Set them to their normal values here.
# for unit testing
sysfs_usb_devices="/sys/bus/usb/devices/*"
# Install udev rules and create device nodes for usb access
# To unit test, set $EXTERN to point to a function simulating these
# functions (defined further up in this file): install_udev;
# install_create_usb_node_for_sysfs. See the code for usage.
# nodes unless INSTALL_NO_GROUP=1 in
# /etc/default/virtualbox. Optional.
# install udev rule (disable with INSTALL_NO_UDEV=1 in
# /etc/default/virtualbox)
else
fi
# Build our device tree
for i in ${sysfs_usb_devices}; do # This line intentionally without quotes.
"${usb_group}"
done
}
# XXX SELinux: allow text relocation entries
fi
}