VirtualBox

Changeset 37122 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 17, 2011 11:06:19 AM (14 years ago)
Author:
vboxsync
Message:

Installer/linux: refactored udev rule installation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/linux/installer-utils.sh

    r37120 r37122  
    3333}
    3434
    35 udev_write_rules() {
     35udev_write_vboxdrv() {
    3636    VBOXDRV_GRP="$1"
    3737    VBOXDRV_MODE="$2"
    38     INSTALLATION_DIR="$3"
    39     USB_GROUP="$4"
    4038
    41     echo "KERNEL=${udev_fix}\"vboxdrv\", NAME=\"vboxdrv\", OWNER=\"root\", GROUP=\"$VBOXDRV_GRP\", MODE=\"$VBOXDRV_MODE\""
    42     echo "SUBSYSTEM=${udev_fix}\"usb_device\", ACTION=${udev_fix}\"add\", RUN=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh \$major \$minor \$attr{bDeviceClass}${USB_GROUP}\""
    43     echo "SUBSYSTEM=${udev_fix}\"usb\", ACTION=${udev_fix}\"add\", ENV{DEVTYPE}=${udev_fix}\"usb_device\", RUN=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh \$major \$minor \$attr{bDeviceClass}${USB_GROUP}\""
    44     echo "SUBSYSTEM=${udev_fix}\"usb_device\", ACTION=${udev_fix}\"remove\", RUN=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh --remove \$major \$minor\""
    45     echo "SUBSYSTEM=${udev_fix}\"usb\", ACTION=${udev_fix}\"remove\", ENV{DEVTYPE}=${udev_fix}\"usb_device\", RUN=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh --remove \$major \$minor\""
     39    echo "KERNEL==\"vboxdrv\", NAME=\"vboxdrv\", OWNER=\"root\", GROUP=\"$VBOXDRV_GRP\", MODE=\"$VBOXDRV_MODE\""
     40}
     41
     42udev_write_usb() {
     43    INSTALLATION_DIR="$1"
     44    USB_GROUP="$2"
     45
     46    echo "SUBSYSTEM==\"usb_device\", ACTION==\"add\", RUN=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh \$major \$minor \$attr{bDeviceClass}${USB_GROUP}\""
     47    echo "SUBSYSTEM==\"usb\", ACTION==\"add\", ENV{DEVTYPE}==\"usb_device\", RUN=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh \$major \$minor \$attr{bDeviceClass}${USB_GROUP}\""
     48    echo "SUBSYSTEM==\"usb_device\", ACTION==\"remove\", RUN=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh --remove \$major \$minor\""
     49    echo "SUBSYSTEM==\"usb\", ACTION==\"remove\", ENV{DEVTYPE}==\"usb_device\", RUN=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh --remove \$major \$minor\""
    4650}
    4751
     
    5761    case "$USB_GROUP" in ?*) USB_GROUP=" $USB_GROUP" ;; esac
    5862    case "$NO_INSTALL" in
    59         "1") ;;
    60         *)
     63    "1") ;;
     64    *)
    6165        if my_test -d /etc/udev/rules.d; then
    6266            udev_call=""
     
    7074                fi
    7175            fi
    72             udev_fix="="
     76            udev_fix=""
    7377            if [ "${udev_call}" != "" ]; then
    7478                udev_out=`${udev_call}`
    7579                udev_ver=`expr "$udev_out" : '[^0-9]*\([0-9]*\)'`
    7680                if [ "$udev_ver" = "" -o "$udev_ver" -lt 55 ]; then
    77                     udev_fix=""
     81                    udev_fix="1"
    7882                fi
    7983            fi
    80             udev_write_rules "$VBOXDRV_GRP" "$VBOXDRV_MODE" \
    81                              "$INSTALLATION_DIR" "$USB_GROUP"
     84            case "$udev_fix" in
     85            "1")
     86                udev_write_vboxdrv "$VBOXDRV_GRP" "$VBOXDRV_MODE" |
     87                    sed 's/\([^+=]*\)[+=]*\([^"]*"[^"]*"\)/\1=\2/g'
     88                udev_write_usb "$INSTALLATION_DIR" "$USB_GROUP" |
     89                    sed 's/\([^+=]*\)[+=]*\([^"]*"[^"]*"\)/\1=\2/g'
     90                ;;
     91            *)
     92                udev_write_vboxdrv "$VBOXDRV_GRP" "$VBOXDRV_MODE"
     93                udev_write_usb "$INSTALLATION_DIR" "$USB_GROUP"
     94                ;;
     95            esac
     96               
    8297        fi
    8398        ;;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette