VirtualBox

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

Last change on this file since 81386 was 81386, checked in by vboxsync, 5 years ago

vboximg-mount: Enable and pack vboximg-mount on Linux by default, bugref:3641

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