VirtualBox

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

Last change on this file since 95475 was 95323, checked in by vboxsync, 3 years ago

rdesktop-vrdp: Drop as it is too old and practically abandoned, bugref:10245

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette