2 # Contributor: Balwinder S "bsd" Dheeman (bdheeman AT gmail.com)
3 # Credits: thotypous <matiasΘarchlinux-br·org>
4 # Maintainer: Balwinder S "bsd" Dheeman (bdheeman AT gmail.com)
11 pkgdesc="A general-purpose full virtualizer for x86 hardware (Binary Edition, Personal Use)"
12 url=http://www.virtualbox.org/
14 arch=('i686' 'x86_64')
15 depends=('gcc' 'make' 'kernel26-headers' 'libxi' 'libxcursor' 'libxrandr' 'libxmu')
16 makedepends=('python2' 'qt' 'sdl')
17 optdepends=('alsa-lib: for ALSA support'
18 'dkms: for building and loading vboxhost modules'
19 'libgl: for shared OpenGL support'
20 'libxt: for shared clipboard support'
21 'mesa: for OpenGL support'
22 'pulseaudio: for PulseAudio support'
23 'python2: for VirtualBox SDK'
24 'qt: for Oracle VirtualBox QT4 GUI on X-Window System'
25 'sdl: for Oracle VBoxSDL and VirtualBox GUI on console'
26 'vfuse: for mounting VBox (VDI/VMDK/VHD) disk images')
28 provides=("virtualbox=${_pkgver}")
29 conflicts=('virtualbox_bin' 'virtualbox-ose' 'virtualbox-modules')
30 backup=('etc/conf.d/vboxdrv')
31 install=${pkgname%-*}.install
33 md5sums=('22426a818a4973fdf54ab91e4a692d85'
34 '87c2c827f9a0432039500d37f6d0477e'
35 'd6b5f065118f145095a013da0e987c17'
36 '28334ec9f6da56d1094e94f7796ff31a')
39 i686|i[3-5]86) _arch='x86';;
40 x86_64|amd64) _arch='amd64'; md5sums[0]='3a8f19609518416be9f3e0c833fcc25b';;
41 # The following should not happen; provided you're using 'makepkg' ;)
42 *) error "Unknown or invalid CARCH=$CARCH"; exit 1
45 source=(http://download.virtualbox.org/virtualbox/${_pkgver}/VirtualBox-${_pkgver}-${_pkgbld}-Linux_${_arch}.run
48 "${pkgname%-*}.desktop")
51 # Unpack the binary package
52 msg2 "Unpacking the Oracle binaries..."
53 echo yes | sh "VirtualBox-${_pkgver}-${_pkgbld}-Linux_${_arch}.run" --target "$srcdir" \
54 --nox11 --noexec &>/dev/null || return 1
55 mkdir -p "$pkgdir/opt/VirtualBox"
56 cd "$pkgdir/opt/VirtualBox"
57 tar xf "$srcdir/VirtualBox.tar.bz2" || return 1
59 msg2 "Fixing permissions..."
60 # Mark set-user-ID-on-execution, if release is marked as a hardened build
61 if egrep '^HARDENED="1"' "$srcdir/install.sh" &> /dev/null; then
62 chmod 4511 "VirtualBox" "VBoxSDL" "VBoxHeadless" "VBoxNetDHCP"
63 for _n in "VBoxVMM.so" "VBoxREM.so" "VBoxRT.so" "VBoxDDU.so" "VBoxXPCOM.so"; do
64 ln -sf "/opt/VirtualBox/${_n}" "components"
68 # VBoxNetAdpCtl needs to be suid root, even if this is not a hardened build
69 chmod 4511 "VBoxNetAdpCtl"
71 msg2 "Making it nice..."
72 # Replace VirtualBox built-in Qt by system Qt libraries
73 # Fixes problems with some KDE themes reported by users
74 ln -fs "/usr/lib/libQtCore.so.4" "libQtCoreVBox.so.4"
75 ln -fs "/usr/lib/libQtGui.so.4" "libQtGuiVBox.so.4"
76 ln -fs "/usr/lib/libQtNetwork.so.4" "libQtNetworkVBox.so.4"
77 ln -fs "/usr/lib/libQtOpenGL.so.4" "libQtOpenGLVBox.so.4"
79 # Patch "vboxshell.py" to use Python 2.x instead of Python 3
80 sed -i 's#/usr/bin/python#\02#' "$pkgdir/opt/VirtualBox/vboxshell.py"
83 cd "$pkgdir/opt/VirtualBox/sdk/installer"
84 VBOX_INSTALL_PATH="/opt/VirtualBox" python2 vboxapisetup.py install --root "${pkgdir}" || return 1
86 cd "$pkgdir/opt/VirtualBox"
88 # Symlink the launchers
89 mkdir -p "$pkgdir/usr/bin"
90 for _app in "VirtualBox" "VBoxHeadless" "VBoxManage" "VBoxSDL" "VBoxSVC" \
91 "VBoxTunctl" "VBoxNetAdpCtl" "rdesktop-vrdp"; do
92 ln -s "/opt/VirtualBox/${_app}" "$pkgdir/usr/bin/${_app}"
95 # Symlink the VBoxGuestAdditions.iso into /usr/share/virtualbox, to make it
96 # a Debian/Ubuntu and, or Fedora compatible installation :)
97 mkdir -p "$pkgdir/usr/share/virtualbox/"
98 ln -s "/opt/VirtualBox/additions/VBoxGuestAdditions.iso" \
99 "$pkgdir/usr/share/virtualbox/VBoxGuestAdditions.iso"
101 # Install rc scripts and defaults
102 install -Dm644 "$srcdir/etc_conf.d_vboxdrv" "$pkgdir/etc/conf.d/vboxdrv"
103 echo "MODULES=($(cd $pkgdir/opt/VirtualBox/src/vboxhost && echo vbox*))" \
104 >> "$pkgdir/etc/conf.d/vboxdrv"
105 echo "VBOX_VERSION=\"${_pkgver}\"" >> "$pkgdir/etc/conf.d/vboxdrv"
106 install -Dm755 "$srcdir/vboxballoonctrl-service.sh" "$pkgdir/etc/rc.d/vboxballoonctrl-service"
107 install -Dm755 "$srcdir/etc_rc.d_vboxdrv" "$pkgdir/etc/rc.d/vboxdrv"
108 install -Dm755 "$srcdir/vboxweb-service.sh" "$pkgdir/etc/rc.d/vboxweb-service"
110 # Install desktop and desktop and icon appropriately
111 install -m644 "$srcdir/virtualbox.desktop" "$pkgdir/opt/VirtualBox/"
112 mkdir -p "$pkgdir/usr/share/applications"
113 ln -s "/opt/VirtualBox/virtualbox.desktop" "$pkgdir/usr/share/applications/VirtualBox.desktop"
114 mkdir -p "$pkgdir/usr/share/pixmaps"
115 ln -s "/opt/VirtualBox/VBox.png" "$pkgdir/usr/share/pixmaps/VBox.png"
117 # Replace some init scripts by simplified stuff
118 sed -i -e 's,/etc/vbox/vbox.cfg,/etc/vbox.cfg,g' "$pkgdir/opt/VirtualBox/VBox.sh" $pkgdir/etc/rc.d/vbox*-service
119 sed -i -e 's,sudo /etc/init.d/vboxdrv restart,sudo /etc/rc.d/vboxdrv restart,g' "$pkgdir/opt/VirtualBox/VBox.sh"
120 sed -i -e 's,sudo /etc/init.d/vboxdrv setup,sudo /etc/rc.d/vboxdrv setup,g' "$pkgdir/opt/VirtualBox/VBox.sh"
121 sed -i -e "s,/etc/init.d/vboxdrv setup' as root\x00,/etc/rc.d/vboxdrv start' as root\x00\x00\x00,g" "$pkgdir/opt/VirtualBox/VBoxVMM.so"
122 sed -i -e "s,/etc/init.d/vboxdrv setup',/etc/rc.d/vboxdrv start' ,g" "$pkgdir/opt/VirtualBox/VirtualBox.so"
125 mkdir -p "$pkgdir/etc/udev/rules.d"
126 echo 'KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"' \
127 > "$pkgdir/etc/udev/rules.d/10-vboxdrv.rules"
128 echo 'SUBSYSTEM=="usb_device", GROUP="vboxusers", MODE="0664"' \
129 >> "$pkgdir/etc/udev/rules.d/10-vboxdrv.rules"
130 echo 'SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="vboxusers", MODE="0664"' \
131 >> "$pkgdir/etc/udev/rules.d/10-vboxdrv.rules"
133 # Point the installation directory to vbox
134 echo '# VirtualBox installation directory' > "$pkgdir/etc/vbox.cfg"
135 echo 'INSTALL_DIR="/opt/VirtualBox"' >> "$pkgdir/etc/vbox.cfg"
138 #mkdir -p "$pkgdir/usr/share/licenses/$pkgname"
139 #ln -s "/opt/VirtualBox/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/PUEL"
141 # create symlinks for dkms, too
142 mkdir -p $pkgdir/usr/src
143 . $pkgdir/etc/conf.d/vboxdrv
144 ln -s /opt/VirtualBox/src/vboxhost $pkgdir/usr/src/vboxhost-$VBOX_VERSION
147 # vim:set ts=4 sw=4 et: