desktop/virtualbox/PKGBUILD

204 lines
8.8 KiB
Bash

#
# Apps Packages for Chakra, part of chakra-project.org
#
# Maintainer: 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.2.2
_build=81494
pkgrel=3
arch=('i686' 'x86_64')
url='http://virtualbox.org/'
license=('GPL2' 'custom:PUEL')
options=('!strip')
_sarch='x86'
[ "${CARCH}" = 'x86_64' ] && _sarch='amd64'
makedepends=('libidl2' 'libxcursor' 'libxinerama' 'libxslt' 'curl' 'linux-headers' 'python2' 'make' 'gcc')
source=("VirtualBox-${pkgver}-${_build}-Linux_${_sarch}.run::http://download.virtualbox.org/virtualbox/${pkgver}/VirtualBox-${pkgver}-${_build}-Linux_${_sarch}.run"
"http://download.virtualbox.org/virtualbox/${pkgver}/Oracle_VM_VirtualBox_Extension_Pack-${pkgver}-${_build}.vbox-extpack"
"http://download.virtualbox.org/virtualbox/${pkgver}/VBoxGuestAdditions_${pkgver}.iso"
'10-vboxdrv.rules'
'vboxdrv.conf'
'vboxweb.conf'
'vboxweb.service'
'vboxusb.service'
'virtualbox.conf'
'vboxsetup.sh'
'PUEL'
'vboxservice.service')
sha256sums=('a4d1d1f3047fb3e242338dbaa59d781b189d58021a04d29aac0a3f8ab7b54733'
'2a0824a7f6b93842feb13fe15de16a1bb33c9221116d62ce759eed6878169c2b'
'26f5390b36a3bb9855846d194dcd287b8e53613b599c6ffd7aff1b451cc7f1f1'
'69417a9e8855cab8e4878886abe138f559fd17ae487d4cd19c8a24974a8bbec2'
'71740893a5f226f9d9fcc607ab9d39b7de816b2759625b34da19162bc7e579ff'
'12dbba3b59991f2b68cddeeeda20236aeff63e11b7e2d1b08d9d6a82225f6651'
'e6e875ef186578b53106d7f6af48e426cdaf1b4e86834f01696b8ef1c685787f'
'251750f41d334ef9871194b3407c2ee2c0330eac92849c6b5d30c46e5c72b765'
'9b3c4dc5385fb3b4aeb841043384879c5c7ee926f5343d6a4177e913604f869d'
'28833ef89fed96aa2cdb071c98687e8aa88e3c4c249b261f9b905e6621fa0e23'
'50658c653cde4dc43ba73a64c72761d2e996fd8e360fc682aa2844e1ad5b045f'
'aaa8d3d71c8585edf43ed11676ccd567cc85fc23752d3c3499506741cef3c9ba')
[[ "${CARCH}" = i686 ]] && sha256sums[0]='c9f1609d9df2f467e1b79ce483e21a912dc3a1431219d5e7528815517de1c175'
_installdir='/opt/VirtualBox'
package_virtualbox() {
pkgdesc='Oracle VM VirtualBox Binary Edition'
arch=('i686' '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')
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}")
conflicts=('virtualbox' 'virtualbox-ose' 'virtualbox-modules')
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}-Linux_${_sarch}.run" --check
echo yes | sh "VirtualBox-${pkgver}-${_build}-Linux_${_sarch}.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 initscript
install -D -m 0644 "${srcdir}/vboxdrv.conf" "${pkgdir}/etc/conf.d/vboxdrv"
install -D -m 0644 "${srcdir}/virtualbox.conf" "${pkgdir}/etc/modules-load.d/virtualbox.conf"
# Install vboxweb initscript
install -D -m 0644 "${srcdir}/vboxweb.conf" "${pkgdir}/etc/conf.d/vboxweb"
install -D -m 0644 "${srcdir}/vboxweb.service" "${pkgdir}/usr/lib/systemd/system/vboxweb.service"
install -D -m 0644 "${srcdir}/vboxusb.service" "${pkgdir}/usr/lib/systemd/system/vboxusb.service"
# Install udev rules
install -D -m 0644 "${srcdir}/10-vboxdrv.rules" "${pkgdir}/lib/udev/rules.d/10-vboxdrv.rules"
ln -s "${_installdir}/VBoxCreateUSBNode.sh" "${pkgdir}/lib/udev/VBoxCreateUSBNode.sh"
# Install setup script for modules and usb devices
install -D -m 0755 "${srcdir}/vboxsetup.sh" "${pkgdir}/usr/bin/vboxsetup"
# 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 -d -m 0755 "${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 -d -m 0755 "${pkgdir}/usr/share/mime/packages"
ln -s "${_installdir}/virtualbox.xml" "${pkgdir}/usr/share/mime/packages/virtualbox.xml"
# Symlink doc
install -d -m 0755 "${pkgdir}/usr/share/doc/${pkgname}"
ln -s "${_installdir}/VirtualBox.chm" "${pkgdir}/usr/share/doc/$pkgname/virtualbox.chm"
# Symlink module sources
install -d -m 0755 "${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 -d -m 0755 "${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}'" >> "${pkgdir}/etc/vbox/vbox.cfg"
chmod 0644 "${pkgdir}/etc/vbox/vbox.cfg"
# Create the directory below if it doesn't exist
install -d -m 0755 "${pkgdir}/var/run/VirtualBox"
}
package_virtualbox-ext-oracle() {
pkgdesc="Oracle VM VirtualBox Extension Pack"
arch=('any')
license=('custom:PUEL')
depends=("virtualbox")
install=${pkgname}.install
cd "${srcdir}"
install -D -m 644 "Oracle_VM_VirtualBox_Extension_Pack-${pkgver}-${_build}.vbox-extpack" \
"${pkgdir}/usr/share/virtualbox/extensions/Oracle_VM_VirtualBox_Extension_Pack-${pkgver}.vbox-extpack"
install -D -m 644 PUEL "${pkgdir}/usr/share/licenses/${pkgname}/PUEL"
}
package_virtualbox-guest-additions() {
pkgdesc="Oracle VM VirtualBox Guest Additions for Chakra"
arch=('i686' 'x86_64')
license=('GPL2')
depends=('linux-headers' 'make' 'gcc')
install=${pkgname}.install
cd "${srcdir}"
# 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"
}