VirtualBox.tmpl.spec revision 81d1b221c2dfff6900e970e273dbb4e81ef6b5d9
#
# Spec file for creating VirtualBox rpm packages
#
#
# Copyright (C) 2006-2010 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# General Public License as published by the Free Software Foundation,
# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
# distribution. VirtualBox OSE is distributed in the hope that it will
# be useful, but WITHOUT ANY WARRANTY of any kind.
#
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Release: 1
%prep
%setup -q
DESTDIR=""
unset DESTDIR
# Mandriva: prevent replacing 'echo' by 'gprintf'
export DONT_GPRINTIFY=1
(export VBOX_INSTALL_PATH=/usr/lib/virtualbox && \
%{__python} ./vboxapisetup.py install --prefix %{_prefix} --root $RPM_BUILD_ROOT)
cd icons
for i in *; do
rmdir $i
done
cd -
for i in VBoxManage VBoxSVC VBoxSDL VirtualBox VBoxHeadless VBoxExtPackHelperApp vboxwebsrv webtest; do
%INSTMOD%
%INSTMOD%
%INSTMOD%
fi
done
if [ -d accessible ]; then
fi
%pre
# defaults
# check for active VMs of the installed (old) package
VBOXSVC_PID=`pidof VBoxSVC 2>/dev/null || true`
if [ -n "$VBOXSVC_PID" ]; then
# executed before the new package is installed!
# try graceful termination; terminate the webservice first
# ask the daemon to terminate immediately
kill -USR1 $VBOXSVC_PID
fi
sleep 1
echo "A copy of VirtualBox is currently running. Please close it and try again."
echo "Please note that it can take up to ten seconds for VirtualBox (in particular"
echo "the VBoxSVC daemon) to finish running."
exit 1
fi
fi
# check for old installation
echo "An old installation of VirtualBox was found. To install this package the"
echo "determine the installation directory of the previous installation. After"
exit 1
fi
fi
# XXX remove old modules from previous versions (disable with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox)
if [ "$INSTALL_NO_VBOXDRV" != "1" ]; then
fi
%post
# defaults
# remove old cruft
echo "Found old version of /etc/init.d/vboxdrv.sh, removing."
fi
fi
# install udev rule (disable with INSTALL_NO_UDEV=1 in /etc/default/virtualbox)
udev_call=""
if [ $? -eq 0 ]; then
else
if [ $? -eq 0 ]; then
fi
fi
udev_fix="="
if [ "${udev_call}" != "" ]; then
udev_fix=""
fi
fi
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\"" \
fi
# Remove old udev description file
fi
# Build our device tree
fi
done
# XXX SELinux: allow text relocation entries
fi
# create users groups (disable with INSTALL_NO_GROUP=1 in /etc/default/virtualbox)
if [ "$INSTALL_NO_GROUP" != "1" ]; then
echo
echo "Creating group 'vboxusers'. VM users must be member of that group!"
echo
fi
# Disable module compilation with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox
if [ "$INSTALL_NO_VBOXDRV" != "1" ]; then
# compile problem
cat << EOF
No precompiled module for this kernel found -- trying to build one. Messages
emitted during module compilation will be logged to $LOG.
EOF
fi
fi
# if INSTALL_NO_VBOXDRV is set to 1, remove all shipped modules
if [ "$INSTALL_NO_VBOXDRV" = "1" ]; then
fi
else
fi
if [ -n "$DKMS" ]; then
fi
fi
fi
# $1==0: remove the last version of the package
# $1==1: install the first time
# $1>=2: upgrade
if [ "$1" = 0 ]; then
fi
if [ "$1" = 0 ]; then
# check for active VMs
VBOXSVC_PID=`pidof VBoxSVC 2>/dev/null || true`
if [ -n "$VBOXSVC_PID" ]; then
kill -USR1 $VBOXSVC_PID
sleep 1
echo "A copy of VirtualBox is currently running. Please close it and try again."
echo "Please note that it can take up to ten seconds for VirtualBox (in particular"
echo "the VBoxSVC daemon) to finish running."
exit 1
fi
fi
fi
if [ "$1" = 0 ]; then
# remove our USB device tree
fi
if [ -n "$DKMS" ]; then
fi
fi
%{?rpm_suse: %{py_sitedir}/*}
%{!?rpm_suse: %{python_sitelib}/*}