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