Changeset 58186 in vbox for trunk/src/VBox/Installer/linux
- Timestamp:
- Oct 12, 2015 1:51:26 PM (9 years ago)
- Location:
- trunk/src/VBox/Installer/linux
- Files:
-
- 8 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Installer/linux/debian/postinst
r58169 r58186 17 17 # abort-remove: (our version): removing this package failed 18 18 # abort-deconfigure: (our version): error during resolving conflicts 19 20 #include installer-common.sh21 19 22 20 LOG="/var/log/vbox-install.log" … … 48 46 addgroup --system vboxusers || true 49 47 fi 50 51 # install udev rule (disable with INSTALL_NO_UDEV=1 in52 # /etc/default/virtualbox) and /dev/vboxdrv and /dev/vboxusb/*/* device nodes53 install_device_node_setup root 0600 /usr/share/virtualbox "${usb_group}"54 48 55 49 # The starters need to be Suid root. They drop the privileges before starting -
trunk/src/VBox/Installer/linux/debian/rules
r58073 r58186 191 191 dh_testroot 192 192 rm -f debian/changelog 193 rm -f debian/preinst debian/p ostinst debian/prerm193 rm -f debian/preinst debian/prerm 194 194 rm -f debian/$(package).init debian/vboxdrv.init 195 195 rm -f debian/vboxballoonctrl-service.init debian/vboxautostart-service.init debian/vboxweb-service.init … … 265 265 sed -e 's|%VER%|$(ver)|g' \ 266 266 debian/prerm.in > debian/prerm 267 sed -e 's|%VER%|$(ver)|g' \268 -e '/#include installer-common.sh/ {' \269 -e "r $(vboxroot)/src/VBox/Installer/linux/installer-common.sh" \270 -e 'd' \271 -e '}' \272 debian/postinst.in > debian/postinst273 267 dh_installdebconf 274 268 dh_installchangelogs -
trunk/src/VBox/Installer/linux/install.sh
r58090 r58186 20 20 # Include routines and utilities needed by the installer 21 21 . ./routines.sh 22 #include installer-common.sh23 22 24 23 LOG="/var/log/vbox-install.log" … … 362 361 fi 363 362 364 install_device_node_setup "$VBOXDRV_GRP" "$VBOXDRV_MODE" "$INSTALLATION_DIR"365 366 363 # Do post-installation common to all installer types, currently service 367 364 # script set-up. -
trunk/src/VBox/Installer/linux/routines.sh
r58109 r58186 358 358 return 0 359 359 } 360 361 set_selinux_permissions() { 362 # XXX SELinux: allow text relocation entries 363 local_INSTALLATION_DIR="$1" # Where the VirtualBox binaries are installed to 364 local_SHARE_DIR="$2" # Where shared bits are installed to 365 if [ -x /usr/bin/chcon ]; then 366 chcon -t texrel_shlib_t "$local_INSTALLATION_DIR"/*VBox* > /dev/null 2>&1 367 chcon -t texrel_shlib_t "$local_INSTALLATION_DIR"/VBoxAuth.so \ 368 > /dev/null 2>&1 369 chcon -t texrel_shlib_t "$local_INSTALLATION_DIR"/VirtualBox.so \ 370 > /dev/null 2>&1 371 chcon -t texrel_shlib_t "$local_INSTALLATION_DIR"/components/VBox*.so \ 372 > /dev/null 2>&1 373 chcon -t java_exec_t "$local_INSTALLATION_DIR"/VirtualBox > /dev/null 2>&1 374 chcon -t java_exec_t "$local_INSTALLATION_DIR"/VBoxSDL > /dev/null 2>&1 375 chcon -t java_exec_t "$local_INSTALLATION_DIR"/VBoxHeadless \ 376 > /dev/null 2>&1 377 chcon -t java_exec_t "$local_INSTALLATION_DIR"/VBoxNetDHCP \ 378 > /dev/null 2>&1 379 chcon -t java_exec_t "$local_INSTALLATION_DIR"/VBoxNetNAT \ 380 > /dev/null 2>&1 381 chcon -t java_exec_t "$local_INSTALLATION_DIR"/VBoxExtPackHelperApp \ 382 > /dev/null 2>&1 383 chcon -t java_exec_t "$local_INSTALLATION_DIR"/vboxwebsrv > /dev/null 2>&1 384 chcon -t java_exec_t "$local_INSTALLATION_DIR"/webtest > /dev/null 2>&1 385 chcon -t bin_t "$local_SHARE_DIR"/src/vboxhost/build_in_tmp \ 386 > /dev/null 2>&1 387 fi 388 } -
trunk/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec
r58090 r58186 101 101 mv VBox.sh $RPM_BUILD_ROOT/usr/bin/VBox 102 102 mv VBoxSysInfo.sh $RPM_BUILD_ROOT/usr/share/virtualbox 103 mv VBoxCreateUSBNode.sh $RPM_BUILD_ROOT/usr/ share/virtualbox103 mv VBoxCreateUSBNode.sh $RPM_BUILD_ROOT/usr/lib/virtualbox 104 104 cp icons/128x128/virtualbox.png $RPM_BUILD_ROOT/usr/share/pixmaps/virtualbox.png 105 105 cd icons … … 246 246 247 247 %post 248 #include installer-common.sh249 250 248 LOG="/var/log/vbox-install.log" 251 249 … … 277 275 fi 278 276 279 # install udev rule (disable with INSTALL_NO_UDEV=1 in /etc/default/virtualbox)280 # and /dev/vboxdrv and /dev/vboxusb/*/* device nodes281 install_device_node_setup root 0600 /usr/share/virtualbox "${usb_group}"282 277 %if %{?rpm_mdv:1}%{!?rpm_mdv:0} 283 278 /sbin/ldconfig -
trunk/src/VBox/Installer/linux/rpm/rules
r58012 r58186 238 238 -e 's|%INITSCRIPTS%|$(if $(filter fedora,$(rpmspec)),initscripts,)|g' \ 239 239 -e "s|%WEBSVC%|$(if $(NOWEBSVC),false,true)|g" \ 240 -e '/#include installer-common.sh/ {' \241 -e "r $(vboxroot)/src/VBox/Installer/linux/installer-common.sh" \242 -e 'd' \243 -e '}' \244 240 rpm/VirtualBox.tmpl.spec > $(archdir)/VirtualBox.spec 245 241 cp vboxdrv.sh $(archdir) -
trunk/src/VBox/Installer/linux/scripts/install.sh
r56299 r58186 237 237 install -d -g 0 -o 0 "${PREFIX}/share/${PACKAGE}" 238 238 mv "${INSTALL_SOURCE}/VBoxSysInfo.sh" "${PREFIX}/share/${PACKAGE}" 239 mv "${INSTALL_SOURCE}/VBoxCreateUSBNode.sh" "${PREFIX}/share/${PACKAGE}"240 239 mv "${INSTALL_SOURCE}/src" "${PREFIX}/share/${PACKAGE}" 241 240 test -z "${NO_QT}" && -
trunk/src/VBox/Installer/linux/uninstall.sh
r57980 r58186 102 102 2> /dev/null 103 103 104 # Remove udev description file105 if [ -f /etc/udev/rules.d/60-vboxdrv.rules ]; then106 rm -f /etc/udev/rules.d/60-vboxdrv.rules 2> /dev/null107 fi108 if [ -f /etc/udev/rules.d/10-vboxdrv.rules ]; then109 rm -f /etc/udev/rules.d/10-vboxdrv.rules 2> /dev/null110 fi111 112 # Remove our USB device tree113 rm -rf /dev/vboxusb 2> /dev/null114 115 104 cwd=`pwd` 116 105 if [ -f $PREV_INSTALLATION/src/Makefile ]; then -
trunk/src/VBox/Installer/linux/vboxdrv.sh
r58012 r58186 43 43 44 44 if [ -n "$INSTALL_DIR" ]; then 45 MODULE_SRC="$INSTALL_DIR/src/vboxhost" 46 else 47 INSTALL_DIR=/usr/lib/virtualbox 48 MODULE_SRC="/usr/share/virtualbox/src/vboxhost" 49 fi 45 50 VIRTUALBOX="$INSTALL_DIR/VirtualBox" 46 51 VBOXMANAGE="$INSTALL_DIR/VBoxManage" 47 MODULE_SRC="$INSTALL_DIR/src/vboxhost"48 else49 VIRTUALBOX="/usr/lib/virtualbox/VirtualBox"50 VBOXMANAGE="/usr/lib/virtualbox/VBoxManage"51 MODULE_SRC="/usr/share/virtualbox/src/vboxhost"52 fi53 52 BUILDINTMP="$MODULE_SRC/build_in_tmp" 54 53 if test -u "${VIRTUALBOX}"; then 55 54 GROUP=root 55 DEVICE_MODE=0600 56 56 else 57 57 GROUP=vboxusers 58 DEVICE_MODE=0660 58 59 fi 59 60 … … 97 98 } 98 99 100 ## Output the vboxdrv part of our udev rule. This is redirected to the right file. 101 udev_write_vboxdrv() { 102 VBOXDRV_GRP="$1" 103 VBOXDRV_MODE="$2" 104 105 echo "KERNEL==\"vboxdrv\", NAME=\"vboxdrv\", OWNER=\"root\", GROUP=\"$VBOXDRV_GRP\", MODE=\"$VBOXDRV_MODE\"" 106 echo "KERNEL==\"vboxdrvu\", NAME=\"vboxdrvu\", OWNER=\"root\", GROUP=\"root\", MODE=\"0666\"" 107 echo "KERNEL==\"vboxnetctl\", NAME=\"vboxnetctl\", OWNER=\"root\", GROUP=\"$VBOXDRV_GRP\", MODE=\"$VBOXDRV_MODE\"" 108 } 109 110 ## Output the USB part of our udev rule. This is redirected to the right file. 111 udev_write_usb() { 112 INSTALLATION_DIR="$1" 113 USB_GROUP="$2" 114 115 echo "SUBSYSTEM==\"usb_device\", ACTION==\"add\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh \$major \$minor \$attr{bDeviceClass}${USB_GROUP}\"" 116 echo "SUBSYSTEM==\"usb\", ACTION==\"add\", ENV{DEVTYPE}==\"usb_device\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh \$major \$minor \$attr{bDeviceClass}${USB_GROUP}\"" 117 echo "SUBSYSTEM==\"usb_device\", ACTION==\"remove\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh --remove \$major \$minor\"" 118 echo "SUBSYSTEM==\"usb\", ACTION==\"remove\", ENV{DEVTYPE}==\"usb_device\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh --remove \$major \$minor\"" 119 } 120 121 ## Generate our udev rule file. This takes a change in udev rule syntax in 122 ## version 55 into account. It only creates rules for USB for udev versions 123 ## recent enough to support USB device nodes. 124 generate_udev_rule() { 125 VBOXDRV_GRP="$1" # The group owning the vboxdrv device 126 VBOXDRV_MODE="$2" # The access mode for the vboxdrv device 127 INSTALLATION_DIR="$3" # The directory VirtualBox is installed in 128 USB_GROUP="$4" # The group that has permission to access USB devices 129 NO_INSTALL="$5" # Set this to "1" to remove but not re-install rules 130 UDEV_STRING="$6" # The output of the udev version command 131 132 # Extra space! 133 case "$USB_GROUP" in ?*) USB_GROUP=" $USB_GROUP" ;; esac 134 case "$NO_INSTALL" in 135 "1") ;; 136 *) 137 udev_ver=`expr "$UDEV_STRING" : '[^0-9]*\([0-9]*\)'` 138 udev_fix="" 139 test "$udev_ver" = "" -o "$udev_ver" -lt 55 && 140 udev_fix="1" 141 udev_do_usb="" 142 test "$udev_ver" -ge 59 && 143 udev_do_usb="1" 144 case "$udev_fix" in 145 "1") 146 udev_write_vboxdrv "$VBOXDRV_GRP" "$VBOXDRV_MODE" | 147 sed 's/\([^+=]*\)[+=]*\([^"]*"[^"]*"\)/\1=\2/g' 148 ;; 149 *) 150 udev_write_vboxdrv "$VBOXDRV_GRP" "$VBOXDRV_MODE" 151 case "$udev_do_usb" in "1") 152 udev_write_usb "$INSTALLATION_DIR" "$USB_GROUP" ;; 153 esac 154 ;; 155 esac 156 ;; 157 esac 158 } 159 160 ## Install udev rule (disable with INSTALL_NO_UDEV=1 in 161 ## /etc/default/virtualbox). 162 install_udev() { 163 VBOXDRV_GRP="$1" # The group owning the vboxdrv device 164 VBOXDRV_MODE="$2" # The access mode for the vboxdrv device 165 INSTALLATION_DIR="$3" # The directory VirtualBox is installed in 166 USB_GROUP="$4" # The group that has permission to access USB devices 167 NO_INSTALL="$5" # Set this to "1" to remove but not re-install rules 168 169 if test -d /etc/udev/rules.d; then 170 udev_out="`udevadm version 2>/dev/null || udevinfo -V 2>/dev/null`" 171 generate_udev_rule "$VBOXDRV_GRP" "$VBOXDRV_MODE" "$INSTALLATION_DIR" \ 172 "$USB_GROUP" "$NO_INSTALL" "$udev_out" 173 fi 174 # Remove old udev description file 175 rm -f /etc/udev/rules.d/10-vboxdrv.rules 2> /dev/null 176 } 177 178 ## Create a usb device node for a given sysfs path to a USB device. 179 install_create_usb_node_for_sysfs() { 180 path="$1" # sysfs path for the device 181 usb_createnode="$2" # Path to the USB device node creation script 182 usb_group="$3" # The group to give ownership of the node to 183 if test -r "${path}/dev"; then 184 dev="`cat "${path}/dev" 2> /dev/null`" 185 major="`expr "$dev" : '\(.*\):' 2> /dev/null`" 186 minor="`expr "$dev" : '.*:\(.*\)' 2> /dev/null`" 187 class="`cat ${path}/bDeviceClass 2> /dev/null`" 188 sh "${usb_createnode}" "$major" "$minor" "$class" \ 189 "${usb_group}" 2>/dev/null 190 fi 191 } 192 193 udev_rule_file=/etc/udev/rules.d/60-vboxdrv.rules 194 sysfs_usb_devices="/sys/bus/usb/devices/*" 195 196 ## Install udev rules and create device nodes for usb access 197 install_device_node_setup() { 198 VBOXDRV_GRP="$1" # The group that should own /dev/vboxdrv 199 VBOXDRV_MODE="$2" # The mode to be used for /dev/vboxdrv 200 INSTALLATION_DIR="$3" # The directory VirtualBox is installed in 201 USB_GROUP="$4" # The group that should own the /dev/vboxusb device 202 # nodes unless INSTALL_NO_GROUP=1 in 203 # /etc/default/virtualbox. Optional. 204 usb_createnode="$INSTALLATION_DIR/VBoxCreateUSBNode.sh" 205 # install udev rule (disable with INSTALL_NO_UDEV=1 in 206 # /etc/default/virtualbox) 207 if [ "$INSTALL_NO_GROUP" != "1" ]; then 208 usb_group=$USB_GROUP 209 vboxdrv_group=$VBOXDRV_GRP 210 else 211 usb_group=root 212 vboxdrv_group=root 213 fi 214 install_udev "${vboxdrv_group}" "$VBOXDRV_MODE" \ 215 "$INSTALLATION_DIR" "${usb_group}" \ 216 "$INSTALL_NO_UDEV" > ${udev_rule_file} 217 # Build our device tree 218 for i in ${sysfs_usb_devices}; do # This line intentionally without quotes. 219 install_create_usb_node_for_sysfs "$i" "${usb_createnode}" \ 220 "${usb_group}" 221 done 222 } 223 99 224 start() 100 225 { 101 begin_msg "Starting VirtualBox kernel modules" console 226 begin_msg "Starting VirtualBox services" console 227 # Create udev rule and USB device nodes. 228 ## todo Wouldn't it make more sense to install the rule to /lib/udev? This 229 ## is not a user-created configuration file after all. 230 ## todo Do we need a udev rule to create /dev/vboxdrv[u] at all? We have 231 ## working fall-back code here anyway, and the "right" code is more complex 232 ## than the fall-back. Unnecessary duplication? 233 install_device_node_setup "$GROUP" "$DEVICE_MODE" "$INSTALL_DIR" 102 234 if [ -d /proc/xen ]; then 103 235 failure "Running VirtualBox in a Xen environment is not supported" … … 163 295 stop() 164 296 { 165 begin_msg "Stopping VirtualBox kernel modules" console 297 begin_msg "Stopping VirtualBox services" console 298 # Remove udev description file 299 rm -f /etc/udev/rules.d/60-vboxdrv.rules 300 rm -f /etc/udev/rules.d/10-vboxdrv.rules 301 302 # Remove our USB device tree 303 rm -rf /dev/vboxusb 304 166 305 if running vboxpci; then 167 306 if ! rmmod vboxpci 2>/dev/null; then … … 241 380 { 242 381 begin_msg "Building VirtualBox kernel modules" console 243 stop >/dev/null244 382 if find /lib/modules/`uname -r` -name "vboxpci\.*" 2>/dev/null|grep -q vboxpci; then 245 383 begin_msg "Removing old VirtualBox pci kernel module"
Note:
See TracChangeset
for help on using the changeset viewer.