VirtualBox.tmpl.spec revision 20fc4a350a4a8e56ffaac6cf57dcd677a7ac36c5
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk# Spec file for creating VirtualBox rpm packages
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk# Copyright (C) 2006-2012 Oracle Corporation
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk# This file is part of VirtualBox Open Source Edition (OSE), as
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk# available from http://www.virtualbox.org. This file is free software;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk# you can redistribute it and/or modify it under the terms of the GNU
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk# General Public License (GPL) as published by the Free Software
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk# Foundation, in version 2 as it comes in the "COPYING" file of the
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkVirtualBox is a powerful PC virtualization solution allowing
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkyou to run a wide range of PC operating systems on your Linux
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenksystem. This includes Windows, Linux, FreeBSD, DOS, OpenBSD
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkand others. VirtualBox comes with a broad feature set and
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkexcellent performance, making it the premier virtualization
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk# Mandriva: prevent replacing 'echo' by 'gprintf'
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkinstall -m 755 -d $RPM_BUILD_ROOT/usr/share/applications
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkinstall -m 755 -d $RPM_BUILD_ROOT/usr/share/pixmaps
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkinstall -m 755 -d $RPM_BUILD_ROOT/usr/share/icons/hicolor
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkinstall -m 755 -d $RPM_BUILD_ROOT%{_defaultdocdir}/virtualbox
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkinstall -m 755 -d $RPM_BUILD_ROOT/usr/lib/virtualbox
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkinstall -m 755 -d $RPM_BUILD_ROOT/usr/lib/virtualbox/ExtensionPacks
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkinstall -m 755 -d $RPM_BUILD_ROOT/usr/share/virtualbox
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkinstall -m 755 -d $RPM_BUILD_ROOT/usr/share/mime/packages
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkmv VBoxEFI32.fd $RPM_BUILD_ROOT/usr/lib/virtualbox || true
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkmv VBoxEFI64.fd $RPM_BUILD_ROOT/usr/lib/virtualbox || true
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkmv *.rel $RPM_BUILD_ROOT/usr/lib/virtualbox || true
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkmv VBoxNetDHCP $RPM_BUILD_ROOT/usr/lib/virtualbox
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkmv VBoxNetAdpCtl $RPM_BUILD_ROOT/usr/lib/virtualbox
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkif [ -f VBoxVolInfo ]; then
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk mv VBoxVolInfo $RPM_BUILD_ROOT/usr/lib/virtualbox
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkmv VBoxXPCOMIPCD $RPM_BUILD_ROOT/usr/lib/virtualbox
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkmv components $RPM_BUILD_ROOT/usr/lib/virtualbox/components
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkmv *.so.4 $RPM_BUILD_ROOT/usr/lib/virtualbox || true
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkln -s ../VBoxVMM.so $RPM_BUILD_ROOT/usr/lib/virtualbox/components/VBoxVMM.so
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkmv VBoxTestOGL $RPM_BUILD_ROOT/usr/lib/virtualbox
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkmv vboxshell.py $RPM_BUILD_ROOT/usr/lib/virtualbox
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk(export VBOX_INSTALL_PATH=/usr/lib/virtualbox && \
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk %{__python} ./vboxapisetup.py install --prefix %{_prefix} --root $RPM_BUILD_ROOT)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkmv VBoxSysInfo.sh $RPM_BUILD_ROOT/usr/share/virtualbox
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkmv VBoxCreateUSBNode.sh $RPM_BUILD_ROOT/usr/share/virtualbox
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkcp icons/128x128/virtualbox.png $RPM_BUILD_ROOT/usr/share/pixmaps/virtualbox.png
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk install -d $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/apps
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk mv $i/virtualbox.png $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/apps
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk install -d $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/mimetypes
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk mv $i/* $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/mimetypes || true
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkmv virtualbox.xml $RPM_BUILD_ROOT/usr/share/mime/packages
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkfor i in VBoxManage VBoxSVC VBoxSDL VirtualBox VBoxHeadless VBoxExtPackHelperApp VBoxBalloonCtrl VBoxAutostart; do
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkfor i in VBoxSDL VirtualBox VBoxHeadless VBoxNetDHCP VBoxNetNAT VBoxNetAdpCtl; do
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk chmod 4511 $RPM_BUILD_ROOT/usr/lib/virtualbox/$i; done
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkif [ -f $RPM_BUILD_ROOT/usr/lib/virtualbox/VBoxVolInfo ]; then
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk chmod 4511 $RPM_BUILD_ROOT/usr/lib/virtualbox/VBoxVolInfo
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk mv ExtensionPacks/VNC $RPM_BUILD_ROOT/usr/lib/virtualbox/ExtensionPacks
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk --save-module-symvers /tmp/vboxdrv-Module.symvers \
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk KBUILD_VERBOSE= KERN_DIR=$d/build MODULE_DIR=$RPM_BUILD_ROOT/$d/misc -j4 \
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk --use-module-symvers /tmp/vboxdrv-Module.symvers \
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk KBUILD_VERBOSE= KERN_DIR=$d/build MODULE_DIR=$RPM_BUILD_ROOT/$d/misc -j4 \
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk --use-module-symvers /tmp/vboxdrv-Module.symvers \
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk KBUILD_VERBOSE= KERN_DIR=$d/build MODULE_DIR=$RPM_BUILD_ROOT/$d/misc -j4 \
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk --use-module-symvers /tmp/vboxdrv-Module.symvers \
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk KBUILD_VERBOSE= KERN_DIR=$d/build MODULE_DIR=$RPM_BUILD_ROOT/$d/misc -j4 \
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk mv kchmviewer $RPM_BUILD_ROOT/usr/lib/virtualbox
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk for i in rdesktop-vrdp.tar.gz rdesktop-vrdp-keymaps; do
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk mv $i $RPM_BUILD_ROOT/usr/share/virtualbox; done
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk mv $i $RPM_BUILD_ROOT/usr/share/virtualbox; done
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkif [ -d accessible ]; then
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk mv accessible $RPM_BUILD_ROOT/usr/lib/virtualbox
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkinstall -D -m 755 vboxdrv.init $RPM_BUILD_ROOT%{_initrddir}/vboxdrv
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkln -sf ../etc/init.d/vboxdrv $RPM_BUILD_ROOT/sbin/rcvboxdrv
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkinstall -D -m 755 vboxballoonctrl-service.init $RPM_BUILD_ROOT%{_initrddir}/vboxballoonctrl-service
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkinstall -D -m 755 vboxautostart-service.init $RPM_BUILD_ROOT%{_initrddir}/vboxautostart-service
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkinstall -D -m 755 vboxweb-service.init $RPM_BUILD_ROOT%{_initrddir}/vboxweb-service
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkln -sf ../etc/init.d/vboxballoonctrl-service $RPM_BUILD_ROOT/sbin/rcvboxballoonctrl-service
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkln -sf ../etc/init.d/vboxautostart-service $RPM_BUILD_ROOT/sbin/rcvboxautostart-service
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkln -sf ../etc/init.d/vboxweb-service $RPM_BUILD_ROOT/sbin/rcvboxweb-service
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxBalloonCtrl
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxballoonctrl
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkln -s /usr/share/virtualbox/src/vboxhost $RPM_BUILD_ROOT/usr/src/vboxhost-%VER%
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkmv virtualbox.desktop $RPM_BUILD_ROOT/usr/share/applications/virtualbox.desktop
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkmv VBox.png $RPM_BUILD_ROOT/usr/share/pixmaps/VBox.png
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk# check for active VMs of the installed (old) package
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkif [ -n "$VBOXSVC_PID" ]; then
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk # executed before the new package is installed!
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk if [ -f /etc/init.d/vboxballoonctrl-service ]; then
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk # try graceful termination; terminate the balloon control service first
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk /etc/init.d/vboxballoonctrl-service stop 2>/dev/null || true
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk if [ -f /etc/init.d/vboxautostart-service ]; then
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk # try graceful termination; terminate the autostart service first
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk /etc/init.d/vboxautostart-service stop 2>/dev/null || true
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk # try graceful termination; terminate the webservice first
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk /etc/init.d/vboxweb-service stop 2>/dev/null || true
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk # ask the daemon to terminate immediately
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk echo "A copy of VirtualBox is currently running. Please close it and try again."
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk echo "Please note that it can take up to ten seconds for VirtualBox (in particular"
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk echo "the VBoxSVC daemon) to finish running."
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk# check for old installation
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk if [ "x$INSTALL_DIR" != "x" -a -d "$INSTALL_DIR" ]; then
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk echo "An old installation of VirtualBox was found. To install this package the"
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk echo "old package has to be removed first. Have a look at /etc/vbox/vbox.cfg to"
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk echo "determine the installation directory of the previous installation. After"
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk echo "uninstalling the old package remove the file /etc/vbox/vbox.cfg."
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk# XXX remove old modules from previous versions (disable with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk find /lib/modules -name "vboxdrv\.*" 2>/dev/null|xargs rm -f 2> /dev/null || true
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk find /lib/modules -name "vboxnetflt\.*" 2>/dev/null|xargs rm -f 2> /dev/null || true
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk find /lib/modules -name "vboxnetadp\.*" 2>/dev/null|xargs rm -f 2> /dev/null || true
%post
#include installer-common.sh
echo "Found old version of /etc/init.d/vboxdrv.sh, removing."
# create users groups (disable with INSTALL_NO_GROUP=1 in /etc/default/virtualbox)
# install udev rule (disable with INSTALL_NO_UDEV=1 in /etc/default/virtualbox)
%{fillup_and_insserv -f -y -Y vboxdrv vboxballoonctrl-service vboxautostart-service vboxweb-service}
# Disable module compilation with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox
cat << EOF
if [ -n "$DKMS" ]; then
if [ -n "$VBOXSVC_PID" ]; then
if [ -n "$DKMS" ]; then