VirtualBox

Changeset 37088 in vbox for trunk/src/VBox/Installer


Ignore:
Timestamp:
May 13, 2011 9:17:29 PM (14 years ago)
Author:
vboxsync
Message:

Installer/linux: split out udev rule installation in order to share the code among the different Linux installers, added a testcase and fixed a broken rule found by the testcase

Location:
trunk/src/VBox/Installer/linux
Files:
5 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/linux/Makefile.kmk

    r36747 r37088  
    1818SUB_DEPTH = ../../../..
    1919include $(KBUILD_PATH)/subheader.kmk
     20
     21# Include sub-makefile.
     22ifdef VBOX_WITH_TESTCASES
     23 include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
     24endif
    2025
    2126ifneq ($(KBUILD_HOST),linux)
     
    310315                $(VBOX_LNX_INST_OUT_DIR)/vboxweb-service.sh \
    311316                $(VBOX_LNX_INST_OUT_DIR)/install.sh \
     317                $(VBOX_PATH_LNX_INST_SRC)/installer-utils.sh \
    312318                $(VBOX_PATH_LNX_INST_SRC)/vboxdrv-pardus.py \
    313319                $(VBOX_PATH_LNX_INST_SRC)/uninstall.sh \
     
    357363                $<
    358364
    359 $(VBOX_LNX_INST_OUT_DIR)/install.sh: $(VBOX_PATH_LNX_INST_SRC)/install.sh $(VBOX_VERSION_STAMP) $(VBOX_SVN_REV_KMK).ts | $$(dir $$@)
     365$(VBOX_LNX_INST_OUT_DIR)/install.sh: $(VBOX_PATH_LNX_INST_SRC)/install.sh $(VBOX_PATH_LNX_INST_SRC)/installer-utils.sh $(VBOX_VERSION_STAMP) $(VBOX_SVN_REV_KMK).ts | $$(dir $$@)
    360366        $(QUIET)$(SED) \
    361367                -e "s;_VERSION_;$(VBOX_VERSION_STRING);g" \
     
    365371                -e "s;_HARDENED_;$(VBOX_WITH_HARDENING);g" \
    366372                -e "s;_PYTHON_;$(VBOX_WITH_PYTHON);g" \
     373                -e '/#include installer-utils.sh/ {' \
     374                -e "r $(PATH_ROOT)/src/VBox/Installer/linux/installer-utils.sh" \
     375                -e 'd' \
     376                -e '}' \
    367377                --output $@ \
    368378                $<
  • trunk/src/VBox/Installer/linux/debian/postinst.in

    r37087 r37088  
    1717#  abort-remove:      (our version): removing this package failed
    1818#  abort-deconfigure: (our version): error during resolving conflicts
     19
     20#include installer-utils.sh
    1921
    2022LOG="/var/log/vbox-install.log"
     
    4143
    4244  # install udev rule (disable with INSTALL_NO_UDEV=1 in /etc/default/virtualbox)
    43   if [ -d /etc/udev/rules.d -a "$INSTALL_NO_UDEV" != "1" ]; then
    44     udev_call=""
    45     udev_app=`which udevadm 2> /dev/null`
    46     if [ $? -eq 0 ]; then
    47       udev_call="${udev_app} version 2> /dev/null"
    48     else
    49       udev_app=`which udevinfo 2> /dev/null`
    50       if [ $? -eq 0 ]; then
    51         udev_call="${udev_app} -V 2> /dev/null"
    52       fi
    53     fi
    54     udev_fix="="
    55     if [ "${udev_call}" != "" ]; then
    56       udev_out=`${udev_call}`
    57       udev_ver=`expr "$udev_out" : '[^0-9]*\([0-9]*\)'`
    58       if [ "$udev_ver" = "" -o "$udev_ver" -lt 55 ]; then
    59         udev_fix=""
    60       fi
    61     fi
    62     echo "KERNEL=${udev_fix}\"vboxdrv\", NAME=\"vboxdrv\", OWNER=\"root\", GROUP=\"root\", MODE=\"0600\"" \
    63       > /etc/udev/rules.d/10-vboxdrv.rules
    64     if [ "$INSTALL_NO_GROUP" != "1" ]; then
    65         usb_group=vboxusers
    66     else
    67         usb_group=root
    68     fi
    69     usb_createnode="/usr/share/virtualbox/VBoxCreateUSBNode.sh"
    70     echo "SUBSYSTEM=${udev_fix}\"usb_device\", ACTION=${udev_fix}\"add\", RUN=\"${usb_createnode} \$major \$minor \$attr{bDeviceClass} ${usb_group}\"" \
    71         >> /etc/udev/rules.d/10-vboxdrv.rules
    72     echo "SUBSYSTEM=${udev_fix}\"usb\", ACTION=${udev_fix}\"add\", ENV{DEVTYPE}==\"usb_device\", RUN=\"${usb_createnode} \$major \$minor \$attr{bDeviceClass} ${usb_group}\"" \
    73         >> /etc/udev/rules.d/10-vboxdrv.rules
    74     echo "SUBSYSTEM=${udev_fix}\"usb_device\", ACTION=${udev_fix}\"remove\", RUN=\"${usb_createnode} --remove \$major \$minor\"" \
    75         >> /etc/udev/rules.d/10-vboxdrv.rules
    76     echo "SUBSYSTEM=${udev_fix}\"usb\", ACTION=${udev_fix}\"remove\", ENV{DEVTYPE}==\"usb_device\", RUN=\"${usb_createnode} --remove \$major \$minor\"" \
    77         >> /etc/udev/rules.d/10-vboxdrv.rules
     45  if [ "$INSTALL_NO_GROUP" != "1" ]; then
     46      usb_group=vboxusers
     47  else
     48      usb_group=root
    7849  fi
    79   # Remove old udev description file
    80   if [ -f /etc/udev/rules.d/60-vboxdrv.rules ]; then
    81       rm -f /etc/udev/rules.d/60-vboxdrv.rules 2> /dev/null
    82   fi
     50  install_udev_package ${usb_group} > /etc/udev/rules.d/10-vboxdrv.rules
    8351  # Build our device tree
    8452  for i in /sys/bus/usb/devices/*; do
  • trunk/src/VBox/Installer/linux/debian/rules

    r36895 r37088  
    340340        cat debian/preinst.in | sed -e 's|%VER%|$(ver)|g' > debian/preinst
    341341        cat debian/prerm.in | sed -e 's|%VER%|$(ver)|g' > debian/prerm
    342         cat debian/postinst.in | sed -e 's|%VER%|$(ver)|g' > debian/postinst
     342        cat debian/postinst.in | \
     343            sed -e 's|%VER%|$(ver)|g' \
     344            -e '/#include installer-utils.sh/ {' \
     345            -e "r $(vboxroot)/src/VBox/Installer/linux/installer-utils.sh" \
     346            -e 'd' \
     347            -e '}' \
     348            > debian/postinst
    343349        dh_installdebconf
    344350        dh_installchangelogs
  • trunk/src/VBox/Installer/linux/install.sh

    r37087 r37088  
    1818PATH=$PATH:/bin:/sbin:/usr/sbin
    1919
    20 # Source functions needed by the installer
     20# Include routines and utilities needed by the installer
    2121. ./routines.sh
     22#include installer-utils.sh
    2223
    2324LOG="/var/log/vbox-install.log"
     
    442443
    443444    # Create udev description file
    444     if [ -d /etc/udev/rules.d ]; then
    445         udev_call=""
    446         udev_app=`which udevadm 2> /dev/null`
    447         if [ $? -eq 0 ]; then
    448             udev_call="${udev_app} version 2> /dev/null"
    449         else
    450             udev_app=`which udevinfo 2> /dev/null`
    451             if [ $? -eq 0 ]; then
    452                 udev_call="${udev_app} -V 2> /dev/null"
    453             fi
    454         fi
    455         udev_fix="="
    456         if [ "${udev_call}" != "" ]; then
    457             udev_out=`${udev_call}`
    458             udev_ver=`expr "$udev_out" : '[^0-9]*\([0-9]*\)'`
    459             if [ "$udev_ver" = "" -o "$udev_ver" -lt 55 ]; then
    460                udev_fix=""
    461             fi
    462         fi
    463         # Write udev rules
    464         echo "KERNEL=${udev_fix}\"vboxdrv\", NAME=\"vboxdrv\", OWNER=\"root\", GROUP=\"$VBOXDRV_GRP\", MODE=\"$VBOXDRV_MODE\"" \
    465           > /etc/udev/rules.d/10-vboxdrv.rules
    466         echo "SUBSYSTEM=${udev_fix}\"usb_device\", ACTION=${udev_fix}\"add\", RUN=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh \$major \$minor \$attr{bDeviceClass}\"" \
    467           >> /etc/udev/rules.d/10-vboxdrv.rules
    468         echo "SUBSYSTEM=${udev_fix}\"usb\", ACTION=${udev_fix}\"add\", ENV{DEVTYPE}==\"usb_device\", RUN=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh \$major \$minor \$attr{bDeviceClass}\"" \
    469           >> /etc/udev/rules.d/10-vboxdrv.rules
    470         echo "SUBSYSTEM=${udev_fix}\"usb_device\", ACTION=${udev_fix}\"remove\", RUN=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh --remove \$major \$minor\"" \
    471           >> /etc/udev/rules.d/10-vboxdrv.rules
    472         echo "SUBSYSTEM=${udev_fix}\"usb\", ACTION=${udev_fix}\"remove\", ENV{DEVTYPE}==\"usb_device\", RUN=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh --remove \$major \$minor\"" \
    473           >> /etc/udev/rules.d/10-vboxdrv.rules
    474     fi
    475     # Remove old udev description file
    476     if [ -f /etc/udev/rules.d/60-vboxdrv.rules ]; then
    477         rm -f /etc/udev/rules.d/60-vboxdrv.rules 2> /dev/null
    478     fi
     445    install_udev_run "$VBOXDRV_GRP" "$VBOXDRV_MODE" "$INSTALLATION_DIR" \
     446        > /etc/udev/rules.d/10-vboxdrv.rules
    479447
    480448    # Build our device tree
  • trunk/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec

    r37087 r37088  
    219219
    220220%post
     221#include installer-utils.sh
     222
    221223LOG="/var/log/vbox-install.log"
    222224
     
    236238
    237239# install udev rule (disable with INSTALL_NO_UDEV=1 in /etc/default/virtualbox)
    238 if [ -d /etc/udev/rules.d -a "$INSTALL_NO_UDEV" != "1" ]; then
    239   udev_call=""
    240   udev_app=`which udevadm 2> /dev/null`
    241   if [ $? -eq 0 ]; then
    242     udev_call="${udev_app} version 2> /dev/null"
    243   else
    244     udev_app=`which udevinfo 2> /dev/null`
    245     if [ $? -eq 0 ]; then
    246       udev_call="${udev_app} -V 2> /dev/null"
    247     fi
    248   fi
    249   udev_fix="="
    250   if [ "${udev_call}" != "" ]; then
    251     udev_out=`${udev_call}`
    252     udev_ver=`expr "$udev_out" : '[^0-9]*\([0-9]*\)'`
    253     if [ "$udev_ver" = "" -o "$udev_ver" -lt 55 ]; then
    254       udev_fix=""
    255     fi
    256   fi
    257   usb_createnode="/usr/share/virtualbox/VBoxCreateUSBNode.sh"
    258   echo "KERNEL=${udev_fix}\"vboxdrv\", NAME=\"vboxdrv\", OWNER=\"root\", GROUP=\"root\", MODE=\"0600\"" \
    259     > /etc/udev/rules.d/10-vboxdrv.rules
    260   echo "SUBSYSTEM=${udev_fix}\"usb_device\", ACTION=${udev_fix}\"add\", RUN=\"${usb_createnode} \$major \$minor \$attr{bDeviceClass}\"" \
    261     >> /etc/udev/rules.d/10-vboxdrv.rules
    262   echo "SUBSYSTEM=${udev_fix}\"usb\", ACTION=${udev_fix}\"add\", ENV{DEVTYPE}==\"usb_device\", RUN=\"${usb_createnode} \$major \$minor \$attr{bDeviceClass}\"" \
    263     >> /etc/udev/rules.d/10-vboxdrv.rules
    264   echo "SUBSYSTEM=${udev_fix}\"usb_device\", ACTION=${udev_fix}\"remove\", RUN=\"${usb_createnode} --remove \$major \$minor\"" \
    265     >> /etc/udev/rules.d/10-vboxdrv.rules
    266   echo "SUBSYSTEM=${udev_fix}\"usb\", ACTION=${udev_fix}\"remove\", ENV{DEVTYPE}==\"usb_device\", RUN=\"${usb_createnode} --remove \$major \$minor\"" \
    267     >> /etc/udev/rules.d/10-vboxdrv.rules
    268 fi
    269 # Remove old udev description file
    270 if [ -f /etc/udev/rules.d/60-vboxdrv.rules ]; then
    271   rm -f /etc/udev/rules.d/60-vboxdrv.rules 2> /dev/null
    272 fi
     240install_udev_package vboxusers > /etc/udev/rules.d/10-vboxdrv.rules
     241
    273242# Build our device tree
    274243for i in /sys/bus/usb/devices/*; do
  • trunk/src/VBox/Installer/linux/rpm/rules

    r36782 r37088  
    171171          -e 's|%INSTMOD%|$(instmod)|g' \
    172172          -e 's|%LIBASOUND%|$(if $(filter lib64,$(rpmlib)),libasound.so.2()(64bit),libasound.so.2)|g' \
     173          -e '/#include installer-utils.sh/ {' \
     174          -e "r $(vboxroot)/src/VBox/Installer/linux/installer-utils.sh" \
     175          -e 'd' \
     176          -e '}' \
    173177           rpm/VirtualBox.tmpl.spec > $(archdir)/VirtualBox.spec
    174178        sed \
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