desktop/virtualbox/PKGBUILD
2014-11-24 11:51:45 +00:00

217 lines
9.5 KiB
Bash

# Maintainer: UtG <utg.chakra.linux[at]gmail[dot]com>
# Contributor: Michael Haesel <michael[dot]haesel[at]gmail[dot]com>
# Contributor: Sebastien Luttringer <seblu[plus]arch[at]seblu[dot]net>
#
# The VirtualBox Guest Additions are extracted into the ${srcdir}, but with
# root rights. So a simple :cp can't delete them. Please remove the ${srcdir}
# with sudo rm -R src.
#
pkgbase=virtualbox
pkgname=('virtualbox' 'virtualbox-ext-oracle' 'virtualbox-guest-additions')
pkgver=4.3.20
_build_virtualbox=96996
pkgrel=2
arch=('x86_64')
url='http://virtualbox.org/'
license=('GPL2' 'custom:PUEL')
options=('!strip')
makedepends=('libidl2' 'libxcursor' 'libxinerama' 'libxslt' 'curl' 'linux-headers' 'python2' 'make' 'gcc')
source=("VirtualBox-${pkgver}-${_build_virtualbox}-Linux_amd64.run::http://download.virtualbox.org/virtualbox/${pkgver}/VirtualBox-${pkgver}-${_build_virtualbox}-Linux_amd64.run"
"http://download.virtualbox.org/virtualbox/${pkgver}/Oracle_VM_VirtualBox_Extension_Pack-${pkgver}-${_build_virtualbox}.vbox-extpack"
"http://download.virtualbox.org/virtualbox/${pkgver}/VBoxGuestAdditions_${pkgver}.iso"
'10-vboxdrv.rules'
'vboxdrv.conf'
'vboxweb.conf'
'vboxweb.service'
'vboxusb.service'
'virtualbox.conf'
'vboxclient.conf'
'vboxsetup.sh'
'PUEL'
'vboxservice.service')
# the checksum can be found here: https://www.virtualbox.org/download/hashes/${pkgver}/SHA256SUMS
sha256sums=('46ac2b2848e71259274ee975a71da0c93189b2f02dad74a84a46e152af68e0ca'
'7e1253f7013e9cdc84a614a0db38b40de7bbd330cb5b85bd3ef3de213773450d'
'9ab48f44ac26a6deb374cb5fe6bad103bbf4fdf5186140e2d40ebe48bd01f3ea'
'e0122a9a33df9704bf73c1904330f95dde25488b49972e8a28f48934f3921c67'
'71740893a5f226f9d9fcc607ab9d39b7de816b2759625b34da19162bc7e579ff'
'12dbba3b59991f2b68cddeeeda20236aeff63e11b7e2d1b08d9d6a82225f6651'
'e6e875ef186578b53106d7f6af48e426cdaf1b4e86834f01696b8ef1c685787f'
'251750f41d334ef9871194b3407c2ee2c0330eac92849c6b5d30c46e5c72b765'
'9b3c4dc5385fb3b4aeb841043384879c5c7ee926f5343d6a4177e913604f869d'
'399c63efe01e57bfe12ddc843bc55ad0a7489bfa530acf568f66f31a4054c05e'
'28833ef89fed96aa2cdb071c98687e8aa88e3c4c249b261f9b905e6621fa0e23'
'50658c653cde4dc43ba73a64c72761d2e996fd8e360fc682aa2844e1ad5b045f'
'aaa8d3d71c8585edf43ed11676ccd567cc85fc23752d3c3499506741cef3c9ba')
_installdir='/opt/VirtualBox'
package_virtualbox() {
pkgdesc='Oracle VM VirtualBox Binary Edition'
arch=('x86_64')
screenshot='https://www.virtualbox.org/raw-attachment/wiki/Screenshots/gnome.png'
license=('GPL2')
depends=('libidl2' 'libxcursor' 'libxinerama' 'libxslt' 'curl' 'linux-headers'
'python2' 'make' 'gcc' 'qt')
optdepends=('virtualbox-ext-oracle: for Oracle extensions'
'dkms: for handling kernel modules with dkms'
'qt: for GUI support'
'sdl: for VBoxSDL and GUI support'
'mesa: for OpenGL support'
'libgl: for shared OpenGL support'
'libxt: for shared clipboard support'
'alsa-lib: for ALSA support'
'pulseaudio: for PulseAudio support')
provides=("virtualbox=${pkgver}")
backup=('etc/vbox/vbox.cfg' 'etc/conf.d/vboxdrv' 'etc/conf.d/vboxweb' 'etc/modules-load.d/virtualbox.conf')
install=${pkgname}.install
# Check and unpack the run package via sh(1)
sh "VirtualBox-${pkgver}-${_build_virtualbox}-Linux_amd64.run" --check
echo yes | sh "VirtualBox-${pkgver}-${_build_virtualbox}-Linux_amd64.run" --target "${srcdir}" \
--nox11 --noexec &> /dev/null
# Unpack bundled files
install -d "${pkgdir}/${_installdir}"
cd "${pkgdir}/${_installdir}"
tar -xjf "${srcdir}/VirtualBox.tar.bz2"
# Hardened build: Mark binaries suid root, create symlinks for working around
# unsupported $ORIGIN/.. in VBoxC.so and make sure the
# directory is only writable by the user (paranoid).
chmod 4511 VirtualBox VBox{SDL,Headless,NetDHCP,NetAdpCtl}
for _lib in VBox{VMM,REM,RT,DDU,XPCOM}.so; do
ln -sf "${_installdir}/${_lib}" "components/${_lib}"
done
chmod go-w .
# Patch "vboxshell.py" to use Python 2.x instead of Python 3
sed -i 's#/usr/bin/python#\02#' "${pkgdir}/${_installdir}/vboxshell.py"
# Update new initscripts way of life in VBox.sh
sed -i -e 's,sudo /etc/init.d/vboxdrv setup,/usr/bin/vboxsetup setup,g' \
"${pkgdir}/${_installdir}/VBox.sh"
# Install vboxdrv configuration
install -Dm0644 "${srcdir}/vboxdrv.conf" "${pkgdir}/etc/conf.d/vboxdrv"
# Install vboxweb configuration
install -Dm0644 "${srcdir}/vboxweb.conf" "${pkgdir}/etc/conf.d/vboxweb"
# Install systemd units
install -Dm0644 "${srcdir}/vboxweb.service" "${pkgdir}/usr/lib/systemd/system/vboxweb.service"
install -Dm0644 "${srcdir}/vboxusb.service" "${pkgdir}/usr/lib/systemd/system/vboxusb.service"
# Install udev rules
install -Dm0644 "${srcdir}/10-vboxdrv.rules" "${pkgdir}/usr/lib/udev/rules.d/10-vboxdrv.rules"
install -dm0755 "${pkgdir}/usr/share/virtualbox"
ln -s "${_installdir}/VBoxCreateUSBNode.sh" "${pkgdir}/usr/share/virtualbox/VBoxCreateUSBNode.sh"
# Install setup script for modules and usb devices
install -Dm0755 "${srcdir}/vboxsetup.sh" "${pkgdir}/usr/bin/vboxsetup"
install -Dm0644 "${srcdir}/virtualbox.conf" "${pkgdir}/etc/modules-load.d/virtualbox.conf"
# Install the SDK
cd "${pkgdir}/${_installdir}/sdk/installer"
VBOX_INSTALL_PATH="${_installdir}" python2 vboxapisetup.py install --root "${pkgdir}"
rm -r -f build
cd "${pkgdir}/${_installdir}"
# Symlink the launchers. Second link can fail if fs is not case sensitive.
install -dm0755 "${pkgdir}/usr/bin"
for _bin in VirtualBox VBox{Headless,Manage,SDL,SVC,Tunctl,NetAdpCtl} rdesktop-vrdp vboxwebsrv; do
ln -s "${_installdir}/${_bin}" "${pkgdir}/usr/bin/${_bin}"
ln -s "${_installdir}/${_bin}" "${pkgdir}/usr/bin/${_bin,,}" &>/dev/null || :
done
# Symlink the desktop icon and ".desktop" files
install -d -m 0755 "${pkgdir}/usr/"{share/applications,share/pixmaps}
ln -s "${_installdir}/VBox.png" "${pkgdir}/usr/share/pixmaps/VBox.png"
ln -s "${_installdir}/icons/128x128/virtualbox.png" "${pkgdir}/usr/share/pixmaps/virtualbox.png"
ln -s "${_installdir}/virtualbox.desktop" "${pkgdir}/usr/share/applications/virtualbox.desktop"
# Symlink mime info
install -dm0755 "${pkgdir}/usr/share/mime/packages"
ln -s "${_installdir}/virtualbox.xml" "${pkgdir}/usr/share/mime/packages/virtualbox.xml"
# Symlink doc
install -dm0755 "${pkgdir}/usr/share/doc/${pkgname}"
ln -s "${_installdir}/VirtualBox.chm" "${pkgdir}/usr/share/doc/$pkgname/virtualbox.chm"
# Symlink module sources
install -dm0755 "${pkgdir}/usr/src"
ln -s "${_installdir}/src/vboxhost" "${pkgdir}/usr/src/vboxhost-${pkgver}"
# Symlink icons
cd "${pkgdir}/${_installdir}/icons"
for _dir in *; do
cd "${_dir}"
install -d -m 0755 "${pkgdir}/usr/share/icons/hicolor/${_dir}/"{apps,mimetypes}
for _icon in *; do
if [[ "${_icon}" = 'virtualbox.png' ]]; then
ln -s "${_installdir}/icons/${_dir}/${_icon}" "${pkgdir}/usr/share/icons/hicolor/${_dir}/apps/${_icon}"
else
ln -s "${_installdir}/icons/${_dir}/${_icon}" "${pkgdir}/usr/share/icons/hicolor/${_dir}/mimetypes/${_icon}"
fi
done
cd - >/dev/null
done
# Write the configuration file
install -dm0755 "${pkgdir}/etc/vbox"
echo "# VirtualBox installation directory" > "${pkgdir}/etc/vbox/vbox.cfg"
echo "INSTALL_DIR='${_installdir}'" >> "${pkgdir}/etc/vbox/vbox.cfg"
echo "# VirtualBox version" >> "${pkgdir}/etc/vbox/vbox.cfg"
echo "INSTALL_VER='${pkgver}'" >> "${pkgdir}/etc/vbox/vbox.cfg"
echo "INSTALL_REV='${_build_virtualbox}'" >> "${pkgdir}/etc/vbox/vbox.cfg"
chmod 0644 "${pkgdir}/etc/vbox/vbox.cfg"
# Use system's Qt
rm "${pkgdir}/opt/VirtualBox/libQtCoreVBox.so.4"
rm "${pkgdir}/opt/VirtualBox/libQtGuiVBox.so.4"
rm "${pkgdir}/opt/VirtualBox/libQtOpenGLVBox.so.4"
rm "${pkgdir}/opt/VirtualBox/libQtNetworkVBox.so.4"
cd "${pkgdir}/opt/VirtualBox"
ln -s /usr/lib/libQtCore.so.4 libQtCoreVBox.so.4
ln -s /usr/lib/libQtGui.so.4 libQtGuiVBox.so.4
ln -s /usr/lib/libQtOpenGL.so.4 libQtOpenGLVBox.so.4
ln -s /usr/lib/libQtNetwork.so.4 libQtNetworkVBox.so.4
# Register into DKMS
install -dm 755 "$pkgdir/var/lib/dkms/vboxhost/$pkgver"
ln -s '/opt/VirtualBox/src/vboxhost' "$pkgdir/var/lib/dkms/vboxhost/$pkgver/source"
}
package_virtualbox-ext-oracle() {
pkgdesc="Oracle VM VirtualBox Extension Pack"
arch=('any')
license=('custom:PUEL')
depends=("virtualbox")
install=${pkgname}.install
install -Dm0644 "Oracle_VM_VirtualBox_Extension_Pack-${pkgver}-${_build_virtualbox}.vbox-extpack" \
"${pkgdir}/usr/share/virtualbox/extensions/Oracle_VM_VirtualBox_Extension_Pack-${pkgver}.vbox-extpack"
install -Dm0644 PUEL "${pkgdir}/usr/share/licenses/${pkgname}/PUEL"
}
package_virtualbox-guest-additions() {
pkgdesc="Oracle VM VirtualBox Guest Additions for Chakra"
arch=('x86_64')
license=('GPL2')
depends=('linux-headers' 'make' 'gcc')
install=${pkgname}.install
# Install VBoxLinuxAdditions
install -Dm0755 VBoxLinuxAdditions.run "${pkgdir}/usr/share/virtualbox/guest-additions/VBoxLinuxAdditions.run"
# Install service file
install -Dm0644 vboxservice.service "${pkgdir}/usr/lib/systemd/system/vboxservice.service"
# Install vboxclient.conf for vboxsf module
install -Dm0644 "${srcdir}/vboxclient.conf" "${pkgdir}/etc/modules-load.d/vboxclient.conf"
}