mirror of
https://gitdl.cn/https://github.com/chakralinux/desktop.git
synced 2025-01-24 10:32:13 +08:00
212 lines
8.7 KiB
Bash
212 lines
8.7 KiB
Bash
# 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.12
|
|
_build=84980
|
|
pkgrel=1
|
|
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}-Linux_amd64.run::http://download.virtualbox.org/virtualbox/${pkgver}/VirtualBox-${pkgver}-${_build}-Linux_amd64.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')
|
|
md5sums=('1a851fbf98d2010981d3b9b291873685'
|
|
'1c52d6d8f0af5c1f86b4e487df49a03d'
|
|
'403098e688f9e7f4273de680f6734983'
|
|
'cee0c968c923760181ae060eab1c2e58'
|
|
'564ceec89e559bd98987f08e86f74825'
|
|
'3ac185709bfe688bb753c46e170d0546'
|
|
'bc9efed88e0469cd7fc460d5a5cd7b4b'
|
|
'4fbd284d87fa4413aec85ca60628ab9e'
|
|
'f2200ed91b6ec089d16cc3ada5418c73'
|
|
'e9c49d382d797dae72827b18353adbd1'
|
|
'08b28b82d0ebd6962025100d4b5414a1'
|
|
'f50243f38c6dd103e7e944f635d66fa0')
|
|
|
|
_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}")
|
|
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_amd64.run" --check
|
|
echo yes | sh "VirtualBox-${pkgver}-${_build}-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 -D -m 0644 "${srcdir}/vboxdrv.conf" "${pkgdir}/etc/conf.d/vboxdrv"
|
|
|
|
# Install vboxweb configuration
|
|
install -D -m 0644 "${srcdir}/vboxweb.conf" "${pkgdir}/etc/conf.d/vboxweb"
|
|
|
|
# Install systemd units
|
|
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}/usr/lib/udev/rules.d/10-vboxdrv.rules"
|
|
install -d -m 0755 "${pkgdir}/usr/share/virtualbox"
|
|
ln -s "${_installdir}/VBoxCreateUSBNode.sh" "${pkgdir}/usr/share/virtualbox/VBoxCreateUSBNode.sh"
|
|
|
|
# Install setup script for modules and usb devices
|
|
install -D -m 0755 "${srcdir}/vboxsetup.sh" "${pkgdir}/usr/bin/vboxsetup"
|
|
install -D -m 0644 "${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 -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"
|
|
|
|
# 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
|
|
}
|
|
|
|
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=('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"
|
|
}
|