VirtualBox.tmpl.spec revision 87c50c527af59e43745475c4b8ac907c5f9bc204
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# Spec file for creating VirtualBox rpm packages
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync# Copyright (C) 2006-2012 Oracle Corporation
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# available from http://www.virtualbox.org. This file is free software;
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# you can redistribute it and/or modify it under the terms of the GNU
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# General Public License as published by the Free Software Foundation,
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# distribution. VirtualBox OSE is distributed in the hope that it will
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# be useful, but WITHOUT ANY WARRANTY of any kind.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncVirtualBox is a powerful PC virtualization solution allowing
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncyou to run a wide range of PC operating systems on your Linux
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncsystem. This includes Windows, Linux, FreeBSD, DOS, OpenBSD
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncand others. VirtualBox comes with a broad feature set and
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncexcellent performance, making it the premier virtualization
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# Mandriva: prevent replacing 'echo' by 'gprintf'
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncinstall -m 755 -d $RPM_BUILD_ROOT/usr/share/applications
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsyncinstall -m 755 -d $RPM_BUILD_ROOT/usr/share/icons/hicolor
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncinstall -m 755 -d $RPM_BUILD_ROOT%{_defaultdocdir}/virtualbox
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncinstall -m 755 -d $RPM_BUILD_ROOT/usr/lib/virtualbox
58b7773f17a933ab8d53f450bed0afcf2f003508vboxsyncinstall -m 755 -d $RPM_BUILD_ROOT/usr/lib/virtualbox/ExtensionPacks
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncinstall -m 755 -d $RPM_BUILD_ROOT/usr/share/virtualbox
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsyncinstall -m 755 -d $RPM_BUILD_ROOT/usr/share/mime/packages
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncmv VBoxEFI32.fd $RPM_BUILD_ROOT/usr/lib/virtualbox || true
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncmv VBoxEFI64.fd $RPM_BUILD_ROOT/usr/lib/virtualbox || true
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncmv components $RPM_BUILD_ROOT/usr/lib/virtualbox/components
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncmv *.so.4 $RPM_BUILD_ROOT/usr/lib/virtualbox || true
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync %{__python} ./vboxapisetup.py install --prefix %{_prefix} --root $RPM_BUILD_ROOT)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncmv VBoxSysInfo.sh $RPM_BUILD_ROOT/usr/share/virtualbox
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsyncmv VBoxCreateUSBNode.sh $RPM_BUILD_ROOT/usr/share/virtualbox
b28fef07fef379ecc179e0bc0d5d1be753e482b5vboxsynccp icons/128x128/virtualbox.png $RPM_BUILD_ROOT/usr/share/pixmaps/virtualbox.png
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync for i in *; do
257927abbaa6d9774427049fcbea552cda362281vboxsync install -d $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/apps
257927abbaa6d9774427049fcbea552cda362281vboxsync mv $i/virtualbox.png $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/apps
24a8dd4360c4b4588fd2c340dd7687379a45e02evboxsync install -d $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/mimetypes
3c49234930c10a52368b992781dae0306a72b5f5vboxsync mv $i/* $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/mimetypes || true
1d17a5f9688f3622ffe088b664588629b1e95801vboxsyncmv virtualbox.xml $RPM_BUILD_ROOT/usr/share/mime/packages
14dcfe007d2a64583946ed5e4cfdb458a7f7f03bvboxsyncfor i in VBoxManage VBoxSVC VBoxSDL VirtualBox VBoxHeadless VBoxExtPackHelperApp VBoxBalloonCtrl VBoxAutostart; do
81d1b221c2dfff6900e970e273dbb4e81ef6b5d9vboxsyncfor i in VBoxSDL VirtualBox VBoxHeadless VBoxNetDHCP VBoxNetAdpCtl; do
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync chmod 4511 $RPM_BUILD_ROOT/usr/lib/virtualbox/$i; done
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync mv ExtensionPacks/VNC $RPM_BUILD_ROOT/usr/lib/virtualbox/ExtensionPacks
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync --save-module-symvers /tmp/vboxdrv-Module.symvers \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync KBUILD_VERBOSE= KERN_DIR=$d/build MODULE_DIR=$RPM_BUILD_ROOT/$d/misc -j4 \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync KBUILD_VERBOSE= KERN_DIR=$d/build MODULE_DIR=$RPM_BUILD_ROOT/$d/misc -j4 \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync KBUILD_VERBOSE= KERN_DIR=$d/build MODULE_DIR=$RPM_BUILD_ROOT/$d/misc -j4 \
9704f1d0180960069e2c4eb8fe2ddee350910e5dvboxsync KBUILD_VERBOSE= KERN_DIR=$d/build MODULE_DIR=$RPM_BUILD_ROOT/$d/misc -j4 \
a3d06a524c4f1cde2f0eada83656543d5a24115dvboxsync for i in rdesktop-vrdp.tar.gz rdesktop-vrdp-keymaps; do
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncif [ -d accessible ]; then
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncinstall -D -m 755 vboxdrv.init $RPM_BUILD_ROOT%{_initrddir}/vboxdrv
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncln -sf ../etc/init.d/vboxdrv $RPM_BUILD_ROOT/sbin/rcvboxdrv
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsyncinstall -D -m 755 vboxballoonctrl-service.init $RPM_BUILD_ROOT%{_initrddir}/vboxballoonctrl-service
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncinstall -D -m 755 vboxautostart-service.init $RPM_BUILD_ROOT%{_initrddir}/vboxautostart-service
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncinstall -D -m 755 vboxweb-service.init $RPM_BUILD_ROOT%{_initrddir}/vboxweb-service
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncln -sf ../etc/init.d/vboxballoonctrl-service $RPM_BUILD_ROOT/sbin/rcvboxballoonctrl-service
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncln -sf ../etc/init.d/vboxautostart-service $RPM_BUILD_ROOT/sbin/rcvboxautostart-service
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncln -sf ../etc/init.d/vboxweb-service $RPM_BUILD_ROOT/sbin/rcvboxweb-service
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncln -s /usr/share/virtualbox/src/vboxhost $RPM_BUILD_ROOT/usr/src/vboxhost-%VER%
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncmv virtualbox.desktop $RPM_BUILD_ROOT/usr/share/applications/virtualbox.desktop
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncmv VBox.png $RPM_BUILD_ROOT/usr/share/pixmaps/VBox.png
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
cf5af7fccfec4bef83f4ec21662d6a6e6cbe3835vboxsync# check for active VMs of the installed (old) package
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsyncif [ -n "$VBOXSVC_PID" ]; then
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync # executed before the new package is installed!
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync if [ -f /etc/init.d/vboxballoonctrl-service ]; then
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync # try graceful termination; terminate the balloon control service first
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync /etc/init.d/vboxballoonctrl-service stop 2>/dev/null || true
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync # try graceful termination; terminate the autostart service first
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync /etc/init.d/vboxautostart-service stop 2>/dev/null || true
cf5af7fccfec4bef83f4ec21662d6a6e6cbe3835vboxsync # try graceful termination; terminate the webservice first
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync /etc/init.d/vboxweb-service stop 2>/dev/null || true
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync # ask the daemon to terminate immediately
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync echo "A copy of VirtualBox is currently running. Please close it and try again."
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync echo "Please note that it can take up to ten seconds for VirtualBox (in particular"
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync echo "the VBoxSVC daemon) to finish running."
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# check for old installation
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync if [ "x$INSTALL_DIR" != "x" -a -d "$INSTALL_DIR" ]; then
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync echo "An old installation of VirtualBox was found. To install this package the"
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync echo "old package has to be removed first. Have a look at /etc/vbox/vbox.cfg to"
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync echo "determine the installation directory of the previous installation. After"
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync echo "uninstalling the old package remove the file /etc/vbox/vbox.cfg."
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# XXX remove old modules from previous versions (disable with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync find /lib/modules -name "vboxdrv\.*" 2>/dev/null|xargs rm -f 2> /dev/null || true
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync find /lib/modules -name "vboxnetflt\.*" 2>/dev/null|xargs rm -f 2> /dev/null || true
f1acc1e99894e016bd1a6ee65c56b3fc064fa4ebvboxsync find /lib/modules -name "vboxnetadp\.*" 2>/dev/null|xargs rm -f 2> /dev/null || true
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsync find /lib/modules -name "vboxpci\.*" 2>/dev/null|xargs rm -f 2> /dev/null || true
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# remove old cruft
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync echo "Found old version of /etc/init.d/vboxdrv.sh, removing."
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync echo "Found old version of /etc/vbox/vbox.cfg, removing."
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# XXX SELinux: allow text relocation entries
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncset_selinux_permissions /usr/lib/virtualbox /usr/share/virtualbox
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# create users groups (disable with INSTALL_NO_GROUP=1 in /etc/default/virtualbox)
d15e1d56958bda40cd12a7c3a71c962b5a710be2vboxsync echo "Creating group 'vboxusers'. VM users must be member of that group!"
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# install udev rule (disable with INSTALL_NO_UDEV=1 in /etc/default/virtualbox)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# and /dev/vboxdrv and /dev/vboxusb/*/* device nodes
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncinstall_device_node_setup root 0600 /usr/share/virtualbox "${usb_group}"
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync%{fillup_and_insserv -f -y -Y vboxdrv vboxballoonctrl-service vboxautostart-service vboxweb-service}
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsyncupdate-mime-database /usr/share/mime &> /dev/null || :
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsyncgtk-update-icon-cache -q /usr/share/icons/hicolor 2> /dev/null || :
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# Disable module compilation with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncif [ ! -f /lib/modules/`uname -r`/misc/vboxdrv.ko ]; then
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync # compile problem
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncNo precompiled module for this kernel found -- trying to build one. Messages
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncemitted during module compilation will be logged to $LOG.
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync# if INSTALL_NO_VBOXDRV is set to 1, remove all shipped modules
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync if [ -n "$DKMS" ]; then
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync $DKMS remove -m vboxhost -v %VER% --all > /dev/null 2>&1 || true
aca7a56d52c58d8b388343450503c22822fd6620vboxsync/etc/init.d/vboxballoonctrl-service start > /dev/null
aca7a56d52c58d8b388343450503c22822fd6620vboxsync# $1==0: remove the last version of the package
aca7a56d52c58d8b388343450503c22822fd6620vboxsync# $1==1: install the first time
aca7a56d52c58d8b388343450503c22822fd6620vboxsync# $1>=2: upgrade
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync /sbin/service vboxballoonctrl-service stop > /dev/null
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync /sbin/service vboxautostart-service stop > /dev/null
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync # check for active VMs
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync if [ -n "$VBOXSVC_PID" ]; then
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync echo "A copy of VirtualBox is currently running. Please close it and try again."
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync echo "Please note that it can take up to ten seconds for VirtualBox (in particular"
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync echo "the VBoxSVC daemon) to finish running."
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncif [ -n "$DKMS" ]; then
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync $DKMS remove -m vboxhost -v %VER% --all > /dev/null 2>&1 || true
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync /sbin/service vboxballoonctrl-service restart > /dev/null 2>&1
47eb60db91f50291b3bd9b72b64d36341972a155vboxsync /sbin/service vboxautostart-service restart > /dev/null 2>&1
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync /sbin/service vboxweb-service restart > /dev/null 2>&1
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync%restart_on_update vboxdrv vboxballoonctrl-service vboxautostart-service vboxweb-service
a0fb1a3d470c09467cd37844f38cf7152c9d2f75vboxsyncupdate-mime-database /usr/share/mime &> /dev/null || :