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