VirtualBox.tmpl.spec revision 88350256a6c78b8631aba5aa5ce249d90a8514a2
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Spec file for creating VirtualBox rpm packages
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Copyright (C) 2006-2010 Oracle Corporation
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# available from http://www.virtualbox.org. This file is free software;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# you can redistribute it and/or modify it under the terms of the GNU
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# General Public License as published by the Free Software Foundation,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# distribution. VirtualBox OSE is distributed in the hope that it will
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# be useful, but WITHOUT ANY WARRANTY of any kind.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncVirtualBox is a powerful PC virtualization solution allowing
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncyou to run a wide range of PC operating systems on your Linux
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncsystem. This includes Windows, Linux, FreeBSD, DOS, OpenBSD
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncand others. VirtualBox comes with a broad feature set and
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncexcellent performance, making it the premier virtualization
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Mandriva: prevent replacing 'echo' by 'gprintf'
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncinstall -m 755 -d $RPM_BUILD_ROOT/usr/share/applications
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncinstall -m 755 -d $RPM_BUILD_ROOT/usr/share/icons/hicolor
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncinstall -m 755 -d $RPM_BUILD_ROOT%{_defaultdocdir}/virtualbox
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncinstall -m 755 -d $RPM_BUILD_ROOT/usr/lib/virtualbox
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncinstall -m 755 -d $RPM_BUILD_ROOT/usr/lib/virtualbox/ExtensionPacks
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncinstall -m 755 -d $RPM_BUILD_ROOT/usr/share/virtualbox
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncinstall -m 755 -d $RPM_BUILD_ROOT/usr/share/mime/packages
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncmv VBoxEFI32.fd $RPM_BUILD_ROOT/usr/lib/virtualbox || true
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncmv VBoxEFI64.fd $RPM_BUILD_ROOT/usr/lib/virtualbox || true
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncmv components $RPM_BUILD_ROOT/usr/lib/virtualbox/components
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncmv *.so.4 $RPM_BUILD_ROOT/usr/lib/virtualbox || true
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync %{__python} ./vboxapisetup.py install --prefix %{_prefix} --root $RPM_BUILD_ROOT)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncmv VBoxSysInfo.sh $RPM_BUILD_ROOT/usr/share/virtualbox
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncmv VBoxCreateUSBNode.sh $RPM_BUILD_ROOT/usr/share/virtualbox
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync for i in *; do
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync install -d $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/mimetypes
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync mv $i/* $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/mimetypes
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncmv virtualbox.xml $RPM_BUILD_ROOT/usr/share/mime/packages
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncfor i in VBoxManage VBoxSVC VBoxSDL VirtualBox VBoxHeadless VBoxExtPackHelperApp vboxwebsrv webtest; do
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncfor i in VBoxSDL VirtualBox VBoxHeadless VBoxNetDHCP VBoxNetAdpCtl VBoxExtPackHelperApp; do
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync chmod 4511 $RPM_BUILD_ROOT/usr/lib/virtualbox/$i; done
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync --save-module-symvers /tmp/vboxdrv-Module.symvers \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync KBUILD_VERBOSE= KERN_DIR=$d/build MODULE_DIR=$RPM_BUILD_ROOT/$d/misc -j4 \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync KBUILD_VERBOSE= KERN_DIR=$d/build MODULE_DIR=$RPM_BUILD_ROOT/$d/misc -j4 \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync KBUILD_VERBOSE= KERN_DIR=$d/build MODULE_DIR=$RPM_BUILD_ROOT/$d/misc -j4 \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncfor i in rdesktop-vrdp.tar.gz rdesktop-vrdp-keymaps additions/VBoxGuestAdditions.iso; do
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncif [ -d accessible ]; then
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncinstall -D -m 755 vboxdrv.init $RPM_BUILD_ROOT%{_initrddir}/vboxdrv
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncln -sf ../etc/init.d/vboxdrv $RPM_BUILD_ROOT/sbin/rcvboxdrv
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncinstall -D -m 755 vboxweb-service.init $RPM_BUILD_ROOT%{_initrddir}/vboxweb-service
%pre
if [ -n "$VBOXSVC_PID" ]; then
# XXX remove old modules from previous versions (disable with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox)
%post
echo "Found old version of /etc/init.d/vboxdrv.sh, removing."
# install udev rule (disable with INSTALL_NO_UDEV=1 in /etc/default/virtualbox)
echo "KERNEL=${udev_fix}\"vboxdrv\", NAME=\"vboxdrv\", OWNER=\"root\", GROUP=\"root\", MODE=\"0600\"" \
echo "SUBSYSTEM=${udev_fix}\"usb_device\", ACTION=${udev_fix}\"add\", RUN=${usb_createnode} \$major \$minor \$attr{bDeviceClass}\"" \
echo "SUBSYSTEM=${udev_fix}\"usb\", ACTION=${udev_fix}\"add\", ENV{DEVTYPE}==\"usb_device\", RUN=${usb_createnode} \$major \$minor \$attr{bDeviceClass}\"" \
echo "SUBSYSTEM=${udev_fix}\"usb_device\", ACTION=${udev_fix}\"remove\", RUN=${usb_createnode} --remove \$major \$minor\"" \
echo "SUBSYSTEM=${udev_fix}\"usb\", ACTION=${udev_fix}\"remove\", ENV{DEVTYPE}==\"usb_device\", RUN=${usb_createnode} --remove \$major \$minor\"" \
# create users groups (disable with INSTALL_NO_GROUP=1 in /etc/default/virtualbox)
# 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