wok-6.x rev 14004

virtualbox-ose: add host usb devices support
author ernia <monghitri@aruba.it>
date Sat Feb 16 21:05:29 2013 +0000 (2013-02-16)
parents d9abc342bfd6
children bc7e7bf309a8
files virtualbox-ose/receipt virtualbox-ose/stuff/10-vboxdrv.rules virtualbox-ose/stuff/60-vboxguest.rules
line diff
     1.1 --- a/virtualbox-ose/receipt	Sat Feb 16 15:38:33 2013 +0100
     1.2 +++ b/virtualbox-ose/receipt	Sat Feb 16 21:05:29 2013 +0000
     1.3 @@ -18,13 +18,13 @@
     1.4  xorg-libXrandr-dev python python-dev xalan-c curl-dev xalan-c-dev \
     1.5  xerces-c-dev openssl-dev zlib-dev libcap-dev glib-dev libvncserver-dev \
     1.6  pam pam-dev bzip2 linux-module-headers pkg-config tar wget vde2-dev \
     1.7 -libpng-dev gsoap-dev libdevmapper-dev"
     1.8 +libpng-dev gsoap-dev libdevmapper-dev makeself"
     1.9  
    1.10  # Rules to configure and make the package.
    1.11  compile_rules()
    1.12  {
    1.13  	cd $src
    1.14 -	patch -Np1 -i "$stuff/virtualbox-4-makeself-check.patch"
    1.15 +	#patch -Np1 -i "$stuff/virtualbox-4-makeself-check.patch"
    1.16  	#patch -Np1 -i "$stuff/virtualbox-4-mkisofs-check.patch"
    1.17  	cp $stuff/LocalConfig.kmk .
    1.18  	./configure \
    1.19 @@ -39,7 +39,7 @@
    1.20  
    1.21  	# build modules. NOTE: we gor ERROR even if it build and cook will exit
    1.22  	# sed ERROR to error.
    1.23 -	cd 
    1.24 +	#cd 
    1.25  	KERN_DIR=/usr/src/linux make -C "$src/out/linux.$BUILD_PLATFORM_ARCH/release/bin/src"
    1.26  	# build guest additions modules
    1.27  	KERN_DIR=/usr/src/linux make -C "$src/out/linux.$BUILD_PLATFORM_ARCH/release/bin/additions/src"
    1.28 @@ -107,8 +107,10 @@
    1.29  	echo 'INSTALL_DIR=/usr/lib/virtualbox' >> "$fs/etc/vbox/vbox.cfg"
    1.30  
    1.31  	#udev
    1.32 -	install -D -m 0644 "$stuff/60-virtualbox.rules" \
    1.33 -	"$fs/etc/udev/rules.d/60-virtualbox.rules"
    1.34 +	#install -D -m 0644 "$stuff/60-virtualbox.rules" \
    1.35 +	#"$fs/etc/udev/rules.d/60-virtualbox.rules"
    1.36 +	install -D -m 0644 "$stuff/10-vboxdrv.rules" \
    1.37 +	"$fs/etc/udev/rules.d/10-vboxdrv.rules"
    1.38  
    1.39  	mkdir -p $fs/usr/lib/virtualbox/sdk/bindings/xpcom/python/
    1.40  	cd sdk/installer
    1.41 @@ -121,16 +123,18 @@
    1.42  	chmod 644 $fs/usr/lib/virtualbox/sdk/bindings/xpcom/python/xpcom/client/*.py
    1.43  	cd $src/out/linux.$BUILD_PLATFORM_ARCH/release/bin
    1.44  
    1.45 -	# virtualbox-modules
    1.46 -	KERNEL_VERSION=`grep  ^VERSION= $WOK/linux/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
    1.47 -
    1.48 -	#cooking installs module in linux major version dir
    1.49 -	KERNEL_VERSION=${KERNEL_VERSION:0:3}
    1.50 +	
    1.51 +	
    1.52 +	KERNEL_VERSION=$(grep  ^VERSION= $WOK/linux/receipt | cut -d "=" -f2 | sed -e 's/"//g')
    1.53 +	#cooking installs modules in linux major version dir
    1.54 +	KBASEVER="${KERNEL_VERSION:0:3}"
    1.55 +	
    1.56  
    1.57  	cd "$src/out/linux.$BUILD_PLATFORM_ARCH/release/bin/src"
    1.58 -	install -D -m644 vboxdrv.ko "$fs/lib/modules/$KERNEL_VERSION-slitaz/misc/vboxdrv.ko"
    1.59 -	install -D -m644 vboxnetflt.ko "$fs/lib/modules/$KERNEL_VERSION-slitaz/misc/vboxnetflt.ko"
    1.60 -	install -D -m644 vboxnetadp.ko "$fs/lib/modules/$KERNEL_VERSION-slitaz/misc/vboxnetadp.ko"
    1.61 +	install -D -m644 vboxdrv.ko "$fs/lib/modules/$KBASEVER-slitaz/misc/vboxdrv.ko"
    1.62 +	install -D -m644 vboxnetflt.ko "$fs/lib/modules/$KBASEVER-slitaz/misc/vboxnetflt.ko"
    1.63 +	install -D -m644 vboxnetadp.ko "$fs/lib/modules/$KBASEVER-slitaz/misc/vboxnetadp.ko"
    1.64 +	#install -D -m644 vboxpci.ko "$fs/lib/modules/$KBASEVER-slitaz/misc/vboxpci.ko"
    1.65  
    1.66  	# virtualbox-ose-additions
    1.67  
    1.68 @@ -166,33 +170,44 @@
    1.69  
    1.70  	cd vboxguest
    1.71  	install -D -m644 vboxguest.ko \
    1.72 -		"$fs/lib/modules/$KERNEL_VERSION-slitaz/misc/vboxguest.ko"
    1.73 +		"$fs/lib/modules/$KBASEVER-slitaz/misc/vboxguest.ko"
    1.74  
    1.75  	cd ../vboxsf
    1.76  	install -D -m644 vboxsf.ko \
    1.77 -		"$fs/lib/modules/$KERNEL_VERSION-slitaz/misc/vboxsf.ko"
    1.78 +		"$fs/lib/modules/$KBASEVER-slitaz/misc/vboxsf.ko"
    1.79  
    1.80  	cd ../vboxvideo
    1.81  	install -D -m644 vboxvideo.ko \
    1.82 -		"$fs/lib/modules/$KERNEL_VERSION-slitaz/misc/vboxvideo.ko"
    1.83 +		"$fs/lib/modules/$KBASEVER-slitaz/misc/vboxvideo.ko"
    1.84  
    1.85  	install -D -m 0644 "$stuff/60-vboxguest.rules" \
    1.86  		"$fs/etc/udev/rules.d/60-vboxguest.rules"
    1.87 +
    1.88  }
    1.89  
    1.90  pre_remove()
    1.91  {
    1.92 -    sed -i "s/vboxdrv vboxnetadp vboxnetflt //" $1/etc/rcS.conf
    1.93 +    #sed -i "s/vboxdrv vboxnetadp vboxnetflt vboxpci//" $1/etc/rcS.conf
    1.94 +    sed -i "s/vboxdrv vboxnetadp vboxnetflt//" $1/etc/rcS.conf
    1.95 +    delgroup vboxusers
    1.96  }
    1.97  
    1.98  post_install()
    1.99  {
   1.100 -	KERNEL_VERSION=`grep  ^VERSION= $1/var/lib/tazpkg/installed/linux/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
   1.101 -	
   1.102 -	#cooking installs module in linux major version dir
   1.103 -	KERNEL_VERSION=${KERNEL_VERSION:0:3}	
   1.104 -
   1.105 -	chroot "$1/" depmod -a $KERNEL_VERSION-slitaz
   1.106 +	#chroot "$1/"
   1.107 +	KERNEL_VERSION=$(uname -r)
   1.108 +	depmod -a $KERNEL_VERSION
   1.109 +	#modprobe -a vboxdrv vboxnetadp vboxnetflt vboxpci
   1.110 +	modprobe -a vboxdrv vboxnetadp vboxnetflt
   1.111  	grep -qs vboxdrv $1/etc/rcS.conf ||
   1.112 -	sed -i 's/LOAD_MODULES="/&vboxdrv vboxnetadp vboxnetflt /' $1/etc/rcS.conf
   1.113 +	#sed -i 's/LOAD_MODULES="/&vboxdrv vboxnetadp vboxnetflt vboxpci/' /etc/rcS.conf
   1.114 +	sed -i 's/LOAD_MODULES="/&vboxdrv vboxnetadp vboxnetflt/' /etc/rcS.conf
   1.115 +	grep -qs vboxuser /etc/group || addgroup -g 199 vboxusers
   1.116 +	echo "add yourself to vboxusers group if you want to access host"
   1.117 +	echo "usb devices: addgroup $USER vboxusers"
   1.118 +	#echo "then logout and login again"
   1.119 +	echo "then reboot, until i find how to make udev do what it should without reboot..."
   1.120 +	#addgroup $USER vboxusers
   1.121 +	udevadm control --reload
   1.122 +	udevadm trigger
   1.123  }
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/virtualbox-ose/stuff/10-vboxdrv.rules	Sat Feb 16 21:05:29 2013 +0000
     2.3 @@ -0,0 +1,5 @@
     2.4 +KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600" ENV{ACL_MANAGE}="1"
     2.5 +SUBSYSTEM=="usb_device", ACTION=="add", RUN="/usr/share/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass} vboxusers"
     2.6 +SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", RUN="/usr/share/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass} vboxusers"
     2.7 +SUBSYSTEM=="usb_device", ACTION=="remove", RUN="/usr/share/virtualbox/VBoxCreateUSBNode.sh --remove $major $minor"
     2.8 +SUBSYSTEM=="usb", ACTION=="remove", ENV{DEVTYPE}=="usb_device", RUN="/usr/share/virtualbox/VBoxCreateUSBNode.sh --remove $major $minor
     3.1 --- a/virtualbox-ose/stuff/60-vboxguest.rules	Sat Feb 16 15:38:33 2013 +0100
     3.2 +++ b/virtualbox-ose/stuff/60-vboxguest.rules	Sat Feb 16 21:05:29 2013 +0000
     3.3 @@ -1,1 +1,2 @@
     3.4 -ACTION=="add", KERNEL=="vboxguest", GROUP="vboxusers", SUBSYSTEM=="misc", OWNER="root", MODE="0600"
     3.5 +ACTION=="add", KERNEL=="vboxguest", SUBSYSTEM=="misc", OWNER="root", MODE="0600"
     3.6 +ACTION=="add", KERNEL=="vboxuser", SUBSYSTEM=="misc", OWNER="root", MODE="0660"