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