VirtualBox

source: vbox/trunk/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec

Last change on this file was 104248, checked in by vboxsync, 3 weeks ago

Installer/linux: Don't consider the VirtualBox binary for setuid treatment, the UI is always split now. bugref:9049

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 13.0 KB
RevLine 
[69401]1# $Id: VirtualBox.tmpl.spec 104248 2024-04-09 09:31:05Z vboxsync $
2## @file
[32008]3# Spec file for creating VirtualBox rpm packages
4#
5
6#
[98103]7# Copyright (C) 2006-2023 Oracle and/or its affiliates.
[32008]8#
[96407]9# This file is part of VirtualBox base platform packages, as
10# available from https://www.virtualbox.org.
[32008]11#
[96407]12# This program is free software; you can redistribute it and/or
13# modify it under the terms of the GNU General Public License
14# as published by the Free Software Foundation, in version 3 of the
15# License.
16#
17# This program is distributed in the hope that it will be useful, but
18# WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20# General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, see <https://www.gnu.org/licenses>.
24#
25# SPDX-License-Identifier: GPL-3.0-only
26#
[32008]27
28%define %SPEC% 1
[40545]29%define %OSE% 1
[63956]30%define %PYTHON% 1
[90038]31%define %QHELP% 1
[63631]32%define VBOXDOCDIR %{_defaultdocdir}/%NAME%
[87455]33%global __requires_exclude_from ^/usr/lib/virtualbox/VBoxPython.*$|^/usr/lib/python.*$|^.*\\.py$
[80570]34%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
[32008]35
36Summary: Oracle VM VirtualBox
37Name: %NAME%
38Version: %BUILDVER%_%BUILDREL%
39Release: 1
40URL: http://www.virtualbox.org/
[56848]41Source: VirtualBox.tar
[98864]42License: GPLv3
[32008]43Group: Applications/System
44Vendor: Oracle Corporation
45BuildRoot: %BUILDROOT%
[96841]46Requires: %INITSCRIPTS% %LIBASOUND% %NETTOOLS% %LIBVULKAN%
[32008]47
48%if %{?rpm_suse:1}%{!?rpm_suse:0}
49%debug_package
50%endif
51
52%MACROSPYTHON%
[80516]53%if %{?__python3:1}%{!?__python3:0}
54%define vbox_python %{__python3}
[80570]55%define vbox_python_sitelib %{python3_sitelib}
[80516]56%else
57%define vbox_python %{__python}
[80570]58%{?rpm_suse: %define vbox_python_sitelib %{py_sitedir}}
59%{!?rpm_suse: %define vbox_python_sitelib %{python_sitelib}}
[80516]60%endif
[32008]61
[76759]62# Remove source code from debuginfo package, needed for Fedora 27 and later
63# as we build the binaries before creating the RPMs.
64%if 0%{?fedora} >= 27
65%undefine _debugsource_packages
66%undefine _debuginfo_subpackages
67%endif
[80516]68%if 0%{?rhel} >= 8
69%undefine _debugsource_packages
70%undefine _debuginfo_subpackages
71%endif
[76759]72
[32008]73%description
74VirtualBox is a powerful PC virtualization solution allowing
75you to run a wide range of PC operating systems on your Linux
76system. This includes Windows, Linux, FreeBSD, DOS, OpenBSD
77and others. VirtualBox comes with a broad feature set and
78excellent performance, making it the premier virtualization
79software solution on the market.
80
81
82%prep
83%setup -q
84DESTDIR=""
85unset DESTDIR
86
87
88%build
89
90
91%install
92# Mandriva: prevent replacing 'echo' by 'gprintf'
93export DONT_GPRINTIFY=1
94rm -rf $RPM_BUILD_ROOT
95install -m 755 -d $RPM_BUILD_ROOT/sbin
96install -m 755 -d $RPM_BUILD_ROOT%{_initrddir}
97install -m 755 -d $RPM_BUILD_ROOT/lib/modules
98install -m 755 -d $RPM_BUILD_ROOT/etc/vbox
99install -m 755 -d $RPM_BUILD_ROOT/usr/bin
100install -m 755 -d $RPM_BUILD_ROOT/usr/src
101install -m 755 -d $RPM_BUILD_ROOT/usr/share/applications
102install -m 755 -d $RPM_BUILD_ROOT/usr/share/pixmaps
[34572]103install -m 755 -d $RPM_BUILD_ROOT/usr/share/icons/hicolor
[58386]104install -m 755 -d $RPM_BUILD_ROOT%{VBOXDOCDIR}
[32008]105install -m 755 -d $RPM_BUILD_ROOT/usr/lib/virtualbox
106install -m 755 -d $RPM_BUILD_ROOT/usr/share/virtualbox
[34573]107install -m 755 -d $RPM_BUILD_ROOT/usr/share/mime/packages
[63953]108%if %{?with_python:1}%{!?with_python:0}
[32008]109(export VBOX_INSTALL_PATH=/usr/lib/virtualbox && \
[103028]110 cd ./sdk/installer/python && \
[80516]111 %{vbox_python} ./vboxapisetup.py install --prefix %{_prefix} --root $RPM_BUILD_ROOT)
[63953]112%endif
[32008]113rm -rf sdk/installer
[92273]114mv UnattendedTemplates $RPM_BUILD_ROOT/usr/share/virtualbox
[32008]115mv nls $RPM_BUILD_ROOT/usr/share/virtualbox
116cp -a src $RPM_BUILD_ROOT/usr/share/virtualbox
117mv VBox.sh $RPM_BUILD_ROOT/usr/bin/VBox
118mv VBoxSysInfo.sh $RPM_BUILD_ROOT/usr/share/virtualbox
[36789]119cp icons/128x128/virtualbox.png $RPM_BUILD_ROOT/usr/share/pixmaps/virtualbox.png
[34573]120cd icons
121 for i in *; do
[50142]122 if [ -f $i/virtualbox.* ]; then
[36757]123 install -d $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/apps
[50142]124 mv $i/virtualbox.* $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/apps
[36757]125 fi
[34577]126 install -d $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/mimetypes
[36753]127 mv $i/* $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/mimetypes || true
[34573]128 rmdir $i
129 done
130cd -
131rmdir icons
[34578]132mv virtualbox.xml $RPM_BUILD_ROOT/usr/share/mime/packages
[40717]133%if %{?is_ose:0}%{!?is_ose:1}
[90367]134%if "%BUILDREL%" == "el7"
135# For el7 we use gcc from devtoolset-4, which is not suitable for kernel work.
[90368]136# See the PATH trickery in src/VBox/Installer/linux/rpm/rules.
[90367]137old_path="$PATH"
[90368]138PATH=${PATH#/opt/rh/devtoolset-4/root/usr/bin:}
[90367]139%endif
[32008]140for d in /lib/modules/*; do
141 if [ -L $d/build ]; then
142 rm -f /tmp/vboxdrv-Module.symvers
[39333]143 ./src/vboxhost/build_in_tmp \
[32008]144 --save-module-symvers /tmp/vboxdrv-Module.symvers \
[40395]145 --module-source `pwd`/src/vboxhost/vboxdrv \
[69090]146 KBUILD_VERBOSE= KERN_VER=$(basename $d) INSTALL_MODULE_PATH=$RPM_BUILD_ROOT -j4 \
[32008]147 %INSTMOD%
[39333]148 ./src/vboxhost/build_in_tmp \
[32008]149 --use-module-symvers /tmp/vboxdrv-Module.symvers \
[40395]150 --module-source `pwd`/src/vboxhost/vboxnetflt \
[69090]151 KBUILD_VERBOSE= KERN_VER=$(basename $d) INSTALL_MODULE_PATH=$RPM_BUILD_ROOT -j4 \
[32008]152 %INSTMOD%
[39333]153 ./src/vboxhost/build_in_tmp \
[32008]154 --use-module-symvers /tmp/vboxdrv-Module.symvers \
[40395]155 --module-source `pwd`/src/vboxhost/vboxnetadp \
[69090]156 KBUILD_VERBOSE= KERN_VER=$(basename $d) INSTALL_MODULE_PATH=$RPM_BUILD_ROOT -j4 \
[32008]157 %INSTMOD%
[82441]158 if [ -e `pwd`/src/vboxhost/vboxpci ]; then
159 ./src/vboxhost/build_in_tmp \
160 --use-module-symvers /tmp/vboxdrv-Module.symvers \
161 --module-source `pwd`/src/vboxhost/vboxpci \
162 KBUILD_VERBOSE= KERN_VER=$(basename $d) INSTALL_MODULE_PATH=$RPM_BUILD_ROOT -j4 \
163 %INSTMOD%
164 fi
[32008]165 fi
166done
[90367]167%if "%BUILDREL%" == "el7"
168# For el7 restore PATH, see above.
169PATH="$old_path"
170unset old_path
171%endif
[58386]172rm -r src
[40717]173%endif
[40545]174for i in additions/VBoxGuestAdditions.iso; do
[32008]175 mv $i $RPM_BUILD_ROOT/usr/share/virtualbox; done
176ln -s VBox $RPM_BUILD_ROOT/usr/bin/VirtualBox
[34682]177ln -s VBox $RPM_BUILD_ROOT/usr/bin/virtualbox
[76758]178ln -s VBox $RPM_BUILD_ROOT/usr/bin/VirtualBoxVM
179ln -s VBox $RPM_BUILD_ROOT/usr/bin/virtualboxvm
[32008]180ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxManage
[34682]181ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxmanage
[57789]182test -f VBoxSDL && ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxSDL
183test -f VBoxSDL && ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxsdl
[32008]184ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxVRDP
185ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxHeadless
[34682]186ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxheadless
[54030]187ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxDTrace
[89669]188ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxAudioTest
[54030]189ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxdtrace
[89669]190ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxaudiotest
[98680]191test -f VBoxBugReport && ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxBugReport
192test -f VBoxBugReport && ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxbugreport
[98679]193test -f VBoxBalloonCtrl && ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxBalloonCtrl
194test -f VBoxBalloonCtrl && ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxballoonctrl
[98680]195test -f VBoxAutostart && ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxAutostart
196test -f VBoxAutostart && ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxautostart
[84974]197test -f vboxwebsrv && ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxwebsrv
[51294]198ln -s /usr/lib/virtualbox/vbox-img $RPM_BUILD_ROOT/usr/bin/vbox-img
[81386]199ln -s /usr/lib/virtualbox/vboximg-mount $RPM_BUILD_ROOT/usr/bin/vboximg-mount
[32183]200ln -s /usr/share/virtualbox/src/vboxhost $RPM_BUILD_ROOT/usr/src/vboxhost-%VER%
[32008]201mv virtualbox.desktop $RPM_BUILD_ROOT/usr/share/applications/virtualbox.desktop
202mv VBox.png $RPM_BUILD_ROOT/usr/share/pixmaps/VBox.png
[58386]203%{!?is_ose: mv LICENSE $RPM_BUILD_ROOT%{VBOXDOCDIR}}
204mv UserManual*.pdf $RPM_BUILD_ROOT%{VBOXDOCDIR}
[96795]205%{?with_qhelp: mv UserManual*.qch UserManual*.qhc $RPM_BUILD_ROOT%{VBOXDOCDIR}}
[59150]206install -m 755 -d $RPM_BUILD_ROOT/usr/lib/debug/usr/lib/virtualbox
[59279]207%if %{?rpm_suse:1}%{!?rpm_suse:0}
208rm *.debug
209%else
[59150]210mv *.debug $RPM_BUILD_ROOT/usr/lib/debug/usr/lib/virtualbox
[59279]211%endif
[58386]212mv * $RPM_BUILD_ROOT/usr/lib/virtualbox
[101363]213if [ -f $RPM_BUILD_ROOT/usr/lib/virtualbox/libQt6CoreVBox.so.6 ]; then
[61488]214 $RPM_BUILD_ROOT/usr/lib/virtualbox/chrpath --keepgoing --replace /usr/lib/virtualbox \
[101363]215 $RPM_BUILD_ROOT/usr/lib/virtualbox/*.so.6 \
[67782]216 $RPM_BUILD_ROOT/usr/lib/virtualbox/plugins/platforms/*.so \
[89486]217 $RPM_BUILD_ROOT/usr/lib/virtualbox/plugins/platformthemes/*.so \
[88318]218 $RPM_BUILD_ROOT/usr/lib/virtualbox/plugins/sqldrivers/*.so \
[101363]219 $RPM_BUILD_ROOT/usr/lib/virtualbox/plugins/styles/*.so || true
[61485]220 echo "[Paths]" > $RPM_BUILD_ROOT/usr/lib/virtualbox/qt.conf
221 echo "Plugins = /usr/lib/virtualbox/plugins" >> $RPM_BUILD_ROOT/usr/lib/virtualbox/qt.conf
222fi
[90369]223rm -f $RPM_BUILD_ROOT/usr/lib/virtualbox/chrpath
[58386]224ln -s ../VBoxVMM.so $RPM_BUILD_ROOT/usr/lib/virtualbox/components/VBoxVMM.so
[104248]225for i in VirtualBoxVM VBoxHeadless VBoxNetDHCP VBoxNetNAT VBoxNetAdpCtl; do
[58386]226 chmod 4511 $RPM_BUILD_ROOT/usr/lib/virtualbox/$i; done
227if [ -f $RPM_BUILD_ROOT/usr/lib/virtualbox/VBoxVolInfo ]; then
228 chmod 4511 $RPM_BUILD_ROOT/usr/lib/virtualbox/VBoxVolInfo
229fi
230test -f $RPM_BUILD_ROOT/usr/lib/virtualbox/VBoxSDL && \
231 chmod 4511 $RPM_BUILD_ROOT/usr/lib/virtualbox/VBoxSDL
[84617]232%if %{?with_python:1}%{!?with_python:0}
233if [ -x /usr/bin/pathfix.py ]; then
234 /usr/bin/pathfix.py -pni "%{__python3} %{py3_shbang_opts}" $RPM_BUILD_ROOT/usr/lib/virtualbox/vboxshell.py
235fi
236%endif
[32008]237
238
239%pre
240# defaults
241[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
242
[57812]243# check for old installation
244if [ -r /etc/vbox/vbox.cfg ]; then
245 . /etc/vbox/vbox.cfg
246 if [ "x$INSTALL_DIR" != "x" -a -d "$INSTALL_DIR" ]; then
247 echo "An old installation of VirtualBox was found. To install this package the"
248 echo "old package has to be removed first. Have a look at /etc/vbox/vbox.cfg to"
249 echo "determine the installation directory of the previous installation. After"
250 echo "uninstalling the old package remove the file /etc/vbox/vbox.cfg."
251 exit 1
252 fi
253fi
254
[32517]255# check for active VMs of the installed (old) package
[57812]256# Execute the installed packages pre-uninstaller if present.
257/usr/lib/virtualbox/prerm-common.sh 2>/dev/null
258# Stop services from older versions without pre-uninstaller.
259/etc/init.d/vboxballoonctrl-service stop 2>/dev/null
260/etc/init.d/vboxautostart-service stop 2>/dev/null
261/etc/init.d/vboxweb-service stop 2>/dev/null
[32251]262VBOXSVC_PID=`pidof VBoxSVC 2>/dev/null || true`
263if [ -n "$VBOXSVC_PID" ]; then
[36714]264 # ask the daemon to terminate immediately
265 kill -USR1 $VBOXSVC_PID
[32251]266 sleep 1
267 if pidof VBoxSVC > /dev/null 2>&1; then
[32517]268 echo "A copy of VirtualBox is currently running. Please close it and try again."
269 echo "Please note that it can take up to ten seconds for VirtualBox (in particular"
270 echo "the VBoxSVC daemon) to finish running."
[32251]271 exit 1
272 fi
[32008]273fi
274
275
276%post
277LOG="/var/log/vbox-install.log"
278
279# defaults
280[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
281
282# remove old cruft
283if [ -f /etc/init.d/vboxdrv.sh ]; then
284 echo "Found old version of /etc/init.d/vboxdrv.sh, removing."
285 rm /etc/init.d/vboxdrv.sh
286fi
287if [ -f /etc/vbox/vbox.cfg ]; then
288 echo "Found old version of /etc/vbox/vbox.cfg, removing."
289 rm /etc/vbox/vbox.cfg
290fi
291rm -f /etc/vbox/module_not_compiled
292
293# create users groups (disable with INSTALL_NO_GROUP=1 in /etc/default/virtualbox)
294if [ "$INSTALL_NO_GROUP" != "1" ]; then
295 echo
296 echo "Creating group 'vboxusers'. VM users must be member of that group!"
297 echo
[49162]298 groupadd -r -f vboxusers 2> /dev/null
[32008]299fi
[38423]300
[32008]301%if %{?rpm_mdv:1}%{!?rpm_mdv:0}
302/sbin/ldconfig
303%update_menus
304%endif
[34573]305update-mime-database /usr/share/mime &> /dev/null || :
[34597]306update-desktop-database -q > /dev/null 2>&1 || :
[34573]307touch --no-create /usr/share/icons/hicolor
308gtk-update-icon-cache -q /usr/share/icons/hicolor 2> /dev/null || :
[32008]309
[32183]310# Disable module compilation with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox
[57986]311if test "${INSTALL_NO_VBOXDRV}" = 1; then
[58090]312 POSTINST_START=--nostart
[57986]313else
[58090]314 POSTINST_START=
[32008]315fi
[57812]316# Install and start the new service scripts.
[57969]317/usr/lib/virtualbox/prerm-common.sh || true
[58090]318/usr/lib/virtualbox/postinst-common.sh ${POSTINST_START} > /dev/null || true
[32008]319
320
321%preun
[57868]322# Called before the package is removed, or during upgrade after (not before)
[69401]323# the new version's "post" scriptlet.
[32517]324# $1==0: remove the last version of the package
[57868]325# $1>=1: upgrade
[32487]326if [ "$1" = 0 ]; then
[57969]327 /usr/lib/virtualbox/prerm-common.sh || exit 1
[48810]328 rm -f /etc/udev/rules.d/60-vboxdrv.rules
[32008]329 rm -f /etc/vbox/license_agreed
330 rm -f /etc/vbox/module_not_compiled
331fi
332
333%postun
334%if %{?rpm_mdv:1}%{!?rpm_mdv:0}
335/sbin/ldconfig
336%{clean_desktop_database}
337%clean_menus
338%endif
[34573]339update-mime-database /usr/share/mime &> /dev/null || :
[34597]340update-desktop-database -q > /dev/null 2>&1 || :
[34573]341touch --no-create /usr/share/icons/hicolor
342gtk-update-icon-cache -q /usr/share/icons/hicolor 2> /dev/null || :
[38404]343rm -rf /usr/lib/virtualbox/ExtensionPacks
[32008]344
345
346%clean
347rm -rf $RPM_BUILD_ROOT
348
349
[102907]350%changelog
351* %DATE% Oracle Corporation <info@virtualbox.org>
352- rebuild RPM package, see https://www.virtualbox.org/wiki/Changelog
353
354
[32008]355%files
356%defattr(-,root,root)
[58386]357%doc %{VBOXDOCDIR}/*
[63953]358%if %{?with_python:1}%{!?with_python:0}
[80570]359%{vbox_python_sitelib}/*
[63953]360%endif
[32008]361/etc/vbox
[43768]362/usr/bin/*
[32008]363/usr/src/vbox*
364/usr/lib/virtualbox
[43768]365/usr/share/applications/*
366/usr/share/icons/hicolor/*/apps/*
367/usr/share/icons/hicolor/*/mimetypes/*
368/usr/share/mime/packages/*
369/usr/share/pixmaps/*
[32008]370/usr/share/virtualbox
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use