1 | #
|
---|
2 | # Spec file for creating VirtualBox rpm packages
|
---|
3 | #
|
---|
4 |
|
---|
5 | #
|
---|
6 | # Copyright (C) 2006-2012 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 | %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
---|
20 |
|
---|
21 | Summary: Oracle VM VirtualBox
|
---|
22 | Name: %NAME%
|
---|
23 | Version: %BUILDVER%_%BUILDREL%
|
---|
24 | Release: 1
|
---|
25 | URL: http://www.virtualbox.org/
|
---|
26 | Source: VirtualBox.tar.bz2
|
---|
27 | License: GPLv2
|
---|
28 | Group: Applications/System
|
---|
29 | Vendor: Oracle Corporation
|
---|
30 | BuildRoot: %BUILDROOT%
|
---|
31 | Requires: %INITSCRIPTS% %LIBASOUND%
|
---|
32 |
|
---|
33 | %if %{?rpm_suse:1}%{!?rpm_suse:0}
|
---|
34 | %debug_package
|
---|
35 | %endif
|
---|
36 |
|
---|
37 | %MACROSPYTHON%
|
---|
38 |
|
---|
39 |
|
---|
40 | %description
|
---|
41 | VirtualBox is a powerful PC virtualization solution allowing
|
---|
42 | you to run a wide range of PC operating systems on your Linux
|
---|
43 | system. This includes Windows, Linux, FreeBSD, DOS, OpenBSD
|
---|
44 | and others. VirtualBox comes with a broad feature set and
|
---|
45 | excellent performance, making it the premier virtualization
|
---|
46 | software solution on the market.
|
---|
47 |
|
---|
48 |
|
---|
49 | %prep
|
---|
50 | %setup -q
|
---|
51 | DESTDIR=""
|
---|
52 | unset DESTDIR
|
---|
53 |
|
---|
54 |
|
---|
55 | %build
|
---|
56 |
|
---|
57 |
|
---|
58 | %install
|
---|
59 | # Mandriva: prevent replacing 'echo' by 'gprintf'
|
---|
60 | export DONT_GPRINTIFY=1
|
---|
61 | rm -rf $RPM_BUILD_ROOT
|
---|
62 | install -m 755 -d $RPM_BUILD_ROOT/sbin
|
---|
63 | install -m 755 -d $RPM_BUILD_ROOT%{_initrddir}
|
---|
64 | install -m 755 -d $RPM_BUILD_ROOT/lib/modules
|
---|
65 | install -m 755 -d $RPM_BUILD_ROOT/etc/vbox
|
---|
66 | install -m 755 -d $RPM_BUILD_ROOT/usr/bin
|
---|
67 | install -m 755 -d $RPM_BUILD_ROOT/usr/src
|
---|
68 | install -m 755 -d $RPM_BUILD_ROOT/usr/share/applications
|
---|
69 | install -m 755 -d $RPM_BUILD_ROOT/usr/share/pixmaps
|
---|
70 | install -m 755 -d $RPM_BUILD_ROOT/usr/share/icons/hicolor
|
---|
71 | install -m 755 -d $RPM_BUILD_ROOT%{_defaultdocdir}/virtualbox
|
---|
72 | install -m 755 -d $RPM_BUILD_ROOT/usr/lib/virtualbox
|
---|
73 | install -m 755 -d $RPM_BUILD_ROOT/usr/lib/virtualbox/ExtensionPacks
|
---|
74 | install -m 755 -d $RPM_BUILD_ROOT/usr/share/virtualbox
|
---|
75 | install -m 755 -d $RPM_BUILD_ROOT/usr/share/mime/packages
|
---|
76 | mv VBoxEFI32.fd $RPM_BUILD_ROOT/usr/lib/virtualbox || true
|
---|
77 | mv VBoxEFI64.fd $RPM_BUILD_ROOT/usr/lib/virtualbox || true
|
---|
78 | mv *.gc $RPM_BUILD_ROOT/usr/lib/virtualbox
|
---|
79 | mv *.r0 $RPM_BUILD_ROOT/usr/lib/virtualbox
|
---|
80 | mv *.rel $RPM_BUILD_ROOT/usr/lib/virtualbox || true
|
---|
81 | mv VBoxNetDHCP $RPM_BUILD_ROOT/usr/lib/virtualbox
|
---|
82 | mv VBoxNetNAT $RPM_BUILD_ROOT/usr/lib/virtualbox
|
---|
83 | mv VBoxNetAdpCtl $RPM_BUILD_ROOT/usr/lib/virtualbox
|
---|
84 | if [ -f VBoxVolInfo ]; then
|
---|
85 | mv VBoxVolInfo $RPM_BUILD_ROOT/usr/lib/virtualbox
|
---|
86 | fi
|
---|
87 | mv VBoxXPCOMIPCD $RPM_BUILD_ROOT/usr/lib/virtualbox
|
---|
88 | mv components $RPM_BUILD_ROOT/usr/lib/virtualbox/components
|
---|
89 | mv *.so $RPM_BUILD_ROOT/usr/lib/virtualbox
|
---|
90 | mv *.so.4 $RPM_BUILD_ROOT/usr/lib/virtualbox || true
|
---|
91 | ln -s ../VBoxVMM.so $RPM_BUILD_ROOT/usr/lib/virtualbox/components/VBoxVMM.so
|
---|
92 | mv VBoxTestOGL $RPM_BUILD_ROOT/usr/lib/virtualbox
|
---|
93 | mv vboxshell.py $RPM_BUILD_ROOT/usr/lib/virtualbox
|
---|
94 | (export VBOX_INSTALL_PATH=/usr/lib/virtualbox && \
|
---|
95 | cd ./sdk/installer && \
|
---|
96 | %{__python} ./vboxapisetup.py install --prefix %{_prefix} --root $RPM_BUILD_ROOT)
|
---|
97 | rm -rf sdk/installer
|
---|
98 | mv sdk $RPM_BUILD_ROOT/usr/lib/virtualbox
|
---|
99 | mv nls $RPM_BUILD_ROOT/usr/share/virtualbox
|
---|
100 | cp -a src $RPM_BUILD_ROOT/usr/share/virtualbox
|
---|
101 | mv VBox.sh $RPM_BUILD_ROOT/usr/bin/VBox
|
---|
102 | mv VBoxSysInfo.sh $RPM_BUILD_ROOT/usr/share/virtualbox
|
---|
103 | mv VBoxCreateUSBNode.sh $RPM_BUILD_ROOT/usr/share/virtualbox
|
---|
104 | cp icons/128x128/virtualbox.png $RPM_BUILD_ROOT/usr/share/pixmaps/virtualbox.png
|
---|
105 | cd icons
|
---|
106 | for i in *; do
|
---|
107 | if [ -f $i/virtualbox.png ]; then
|
---|
108 | install -d $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/apps
|
---|
109 | mv $i/virtualbox.png $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/apps
|
---|
110 | fi
|
---|
111 | install -d $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/mimetypes
|
---|
112 | mv $i/* $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/mimetypes || true
|
---|
113 | rmdir $i
|
---|
114 | done
|
---|
115 | cd -
|
---|
116 | rmdir icons
|
---|
117 | mv virtualbox.xml $RPM_BUILD_ROOT/usr/share/mime/packages
|
---|
118 | for i in VBoxManage VBoxSVC VBoxSDL VirtualBox VBoxHeadless VBoxExtPackHelperApp VBoxBalloonCtrl VBoxAutostart; do
|
---|
119 | mv $i $RPM_BUILD_ROOT/usr/lib/virtualbox; done
|
---|
120 | if %WEBSVC%; then
|
---|
121 | for i in vboxwebsrv webtest; do
|
---|
122 | mv $i $RPM_BUILD_ROOT/usr/lib/virtualbox; done
|
---|
123 | fi
|
---|
124 | for i in VBoxSDL VirtualBox VBoxHeadless VBoxNetDHCP VBoxNetNAT VBoxNetAdpCtl; do
|
---|
125 | chmod 4511 $RPM_BUILD_ROOT/usr/lib/virtualbox/$i; done
|
---|
126 | if [ -f $RPM_BUILD_ROOT/usr/lib/virtualbox/VBoxVolInfo ]; then
|
---|
127 | chmod 4511 $RPM_BUILD_ROOT/usr/lib/virtualbox/VBoxVolInfo
|
---|
128 | fi
|
---|
129 | if [ -d ExtensionPacks/VNC ]; then
|
---|
130 | mv ExtensionPacks/VNC $RPM_BUILD_ROOT/usr/lib/virtualbox/ExtensionPacks
|
---|
131 | fi
|
---|
132 | mv VBoxTunctl $RPM_BUILD_ROOT/usr/bin
|
---|
133 | %if %{?is_ose:0}%{!?is_ose:1}
|
---|
134 | for d in /lib/modules/*; do
|
---|
135 | if [ -L $d/build ]; then
|
---|
136 | rm -f /tmp/vboxdrv-Module.symvers
|
---|
137 | ./src/vboxhost/build_in_tmp \
|
---|
138 | --save-module-symvers /tmp/vboxdrv-Module.symvers \
|
---|
139 | --module-source `pwd`/src/vboxhost/vboxdrv \
|
---|
140 | KBUILD_VERBOSE= KERN_DIR=$d/build MODULE_DIR=$RPM_BUILD_ROOT/$d/misc -j4 \
|
---|
141 | %INSTMOD%
|
---|
142 | ./src/vboxhost/build_in_tmp \
|
---|
143 | --use-module-symvers /tmp/vboxdrv-Module.symvers \
|
---|
144 | --module-source `pwd`/src/vboxhost/vboxnetflt \
|
---|
145 | KBUILD_VERBOSE= KERN_DIR=$d/build MODULE_DIR=$RPM_BUILD_ROOT/$d/misc -j4 \
|
---|
146 | %INSTMOD%
|
---|
147 | ./src/vboxhost/build_in_tmp \
|
---|
148 | --use-module-symvers /tmp/vboxdrv-Module.symvers \
|
---|
149 | --module-source `pwd`/src/vboxhost/vboxnetadp \
|
---|
150 | KBUILD_VERBOSE= KERN_DIR=$d/build MODULE_DIR=$RPM_BUILD_ROOT/$d/misc -j4 \
|
---|
151 | %INSTMOD%
|
---|
152 | ./src/vboxhost/build_in_tmp \
|
---|
153 | --use-module-symvers /tmp/vboxdrv-Module.symvers \
|
---|
154 | --module-source `pwd`/src/vboxhost/vboxpci \
|
---|
155 | KBUILD_VERBOSE= KERN_DIR=$d/build MODULE_DIR=$RPM_BUILD_ROOT/$d/misc -j4 \
|
---|
156 | %INSTMOD%
|
---|
157 | fi
|
---|
158 | done
|
---|
159 | %endif
|
---|
160 | %if %{?is_ose:0}%{!?is_ose:1}
|
---|
161 | mv kchmviewer $RPM_BUILD_ROOT/usr/lib/virtualbox
|
---|
162 | for i in rdesktop-vrdp.tar.gz rdesktop-vrdp-keymaps; do
|
---|
163 | mv $i $RPM_BUILD_ROOT/usr/share/virtualbox; done
|
---|
164 | mv rdesktop-vrdp $RPM_BUILD_ROOT/usr/bin
|
---|
165 | %endif
|
---|
166 | for i in additions/VBoxGuestAdditions.iso; do
|
---|
167 | mv $i $RPM_BUILD_ROOT/usr/share/virtualbox; done
|
---|
168 | if [ -d accessible ]; then
|
---|
169 | mv accessible $RPM_BUILD_ROOT/usr/lib/virtualbox
|
---|
170 | fi
|
---|
171 | install -D -m 755 vboxdrv.init $RPM_BUILD_ROOT%{_initrddir}/vboxdrv
|
---|
172 | %if %{?rpm_suse:1}%{!?rpm_suse:0}
|
---|
173 | ln -sf ../etc/init.d/vboxdrv $RPM_BUILD_ROOT/sbin/rcvboxdrv
|
---|
174 | %endif
|
---|
175 | install -D -m 755 vboxballoonctrl-service.init $RPM_BUILD_ROOT%{_initrddir}/vboxballoonctrl-service
|
---|
176 | install -D -m 755 vboxautostart-service.init $RPM_BUILD_ROOT%{_initrddir}/vboxautostart-service
|
---|
177 | install -D -m 755 vboxweb-service.init $RPM_BUILD_ROOT%{_initrddir}/vboxweb-service
|
---|
178 | %if %{?rpm_suse:1}%{!?rpm_suse:0}
|
---|
179 | ln -sf ../etc/init.d/vboxballoonctrl-service $RPM_BUILD_ROOT/sbin/rcvboxballoonctrl-service
|
---|
180 | ln -sf ../etc/init.d/vboxautostart-service $RPM_BUILD_ROOT/sbin/rcvboxautostart-service
|
---|
181 | ln -sf ../etc/init.d/vboxweb-service $RPM_BUILD_ROOT/sbin/rcvboxweb-service
|
---|
182 | %endif
|
---|
183 | ln -s VBox $RPM_BUILD_ROOT/usr/bin/VirtualBox
|
---|
184 | ln -s VBox $RPM_BUILD_ROOT/usr/bin/virtualbox
|
---|
185 | ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxManage
|
---|
186 | ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxmanage
|
---|
187 | ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxSDL
|
---|
188 | ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxsdl
|
---|
189 | ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxVRDP
|
---|
190 | ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxHeadless
|
---|
191 | ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxheadless
|
---|
192 | ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxBalloonCtrl
|
---|
193 | ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxballoonctrl
|
---|
194 | ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxAutostart
|
---|
195 | ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxautostart
|
---|
196 | ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxwebsrv
|
---|
197 | ln -s /usr/share/virtualbox/src/vboxhost $RPM_BUILD_ROOT/usr/src/vboxhost-%VER%
|
---|
198 | mv virtualbox.desktop $RPM_BUILD_ROOT/usr/share/applications/virtualbox.desktop
|
---|
199 | mv VBox.png $RPM_BUILD_ROOT/usr/share/pixmaps/VBox.png
|
---|
200 |
|
---|
201 |
|
---|
202 | %pre
|
---|
203 | # defaults
|
---|
204 | [ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
|
---|
205 |
|
---|
206 | # check for active VMs of the installed (old) package
|
---|
207 | VBOXSVC_PID=`pidof VBoxSVC 2>/dev/null || true`
|
---|
208 | if [ -n "$VBOXSVC_PID" ]; then
|
---|
209 | # executed before the new package is installed!
|
---|
210 | if [ -f /etc/init.d/vboxballoonctrl-service ]; then
|
---|
211 | # try graceful termination; terminate the balloon control service first
|
---|
212 | /etc/init.d/vboxballoonctrl-service stop 2>/dev/null || true
|
---|
213 | fi
|
---|
214 | if [ -f /etc/init.d/vboxautostart-service ]; then
|
---|
215 | # try graceful termination; terminate the autostart service first
|
---|
216 | /etc/init.d/vboxautostart-service stop 2>/dev/null || true
|
---|
217 | fi
|
---|
218 | if [ -f /etc/init.d/vboxweb-service ]; then
|
---|
219 | # try graceful termination; terminate the webservice first
|
---|
220 | /etc/init.d/vboxweb-service stop 2>/dev/null || true
|
---|
221 | fi
|
---|
222 | # ask the daemon to terminate immediately
|
---|
223 | kill -USR1 $VBOXSVC_PID
|
---|
224 | sleep 1
|
---|
225 | if pidof VBoxSVC > /dev/null 2>&1; then
|
---|
226 | echo "A copy of VirtualBox is currently running. Please close it and try again."
|
---|
227 | echo "Please note that it can take up to ten seconds for VirtualBox (in particular"
|
---|
228 | echo "the VBoxSVC daemon) to finish running."
|
---|
229 | exit 1
|
---|
230 | fi
|
---|
231 | fi
|
---|
232 |
|
---|
233 | # check for old installation
|
---|
234 | if [ -r /etc/vbox/vbox.cfg ]; then
|
---|
235 | . /etc/vbox/vbox.cfg
|
---|
236 | if [ "x$INSTALL_DIR" != "x" -a -d "$INSTALL_DIR" ]; then
|
---|
237 | echo "An old installation of VirtualBox was found. To install this package the"
|
---|
238 | echo "old package has to be removed first. Have a look at /etc/vbox/vbox.cfg to"
|
---|
239 | echo "determine the installation directory of the previous installation. After"
|
---|
240 | echo "uninstalling the old package remove the file /etc/vbox/vbox.cfg."
|
---|
241 | exit 1
|
---|
242 | fi
|
---|
243 | fi
|
---|
244 |
|
---|
245 | # XXX remove old modules from previous versions (disable with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox)
|
---|
246 | if [ "$INSTALL_NO_VBOXDRV" != "1" ]; then
|
---|
247 | find /lib/modules -name "vboxdrv\.*" 2>/dev/null|xargs rm -f 2> /dev/null || true
|
---|
248 | find /lib/modules -name "vboxnetflt\.*" 2>/dev/null|xargs rm -f 2> /dev/null || true
|
---|
249 | find /lib/modules -name "vboxnetadp\.*" 2>/dev/null|xargs rm -f 2> /dev/null || true
|
---|
250 | find /lib/modules -name "vboxpci\.*" 2>/dev/null|xargs rm -f 2> /dev/null || true
|
---|
251 | fi
|
---|
252 |
|
---|
253 |
|
---|
254 | %post
|
---|
255 | #include installer-common.sh
|
---|
256 |
|
---|
257 | LOG="/var/log/vbox-install.log"
|
---|
258 |
|
---|
259 | # defaults
|
---|
260 | [ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
|
---|
261 |
|
---|
262 | # remove old cruft
|
---|
263 | if [ -f /etc/init.d/vboxdrv.sh ]; then
|
---|
264 | echo "Found old version of /etc/init.d/vboxdrv.sh, removing."
|
---|
265 | rm /etc/init.d/vboxdrv.sh
|
---|
266 | fi
|
---|
267 | if [ -f /etc/vbox/vbox.cfg ]; then
|
---|
268 | echo "Found old version of /etc/vbox/vbox.cfg, removing."
|
---|
269 | rm /etc/vbox/vbox.cfg
|
---|
270 | fi
|
---|
271 | rm -f /etc/vbox/module_not_compiled
|
---|
272 |
|
---|
273 | # XXX SELinux: allow text relocation entries
|
---|
274 | %if %{?rpm_redhat:1}%{!?rpm_redhat:0}
|
---|
275 | set_selinux_permissions /usr/lib/virtualbox /usr/share/virtualbox
|
---|
276 | %endif
|
---|
277 |
|
---|
278 | # create users groups (disable with INSTALL_NO_GROUP=1 in /etc/default/virtualbox)
|
---|
279 | if [ "$INSTALL_NO_GROUP" != "1" ]; then
|
---|
280 | echo
|
---|
281 | echo "Creating group 'vboxusers'. VM users must be member of that group!"
|
---|
282 | echo
|
---|
283 | groupadd -f vboxusers 2> /dev/null
|
---|
284 | fi
|
---|
285 |
|
---|
286 | # install udev rule (disable with INSTALL_NO_UDEV=1 in /etc/default/virtualbox)
|
---|
287 | # and /dev/vboxdrv and /dev/vboxusb/*/* device nodes
|
---|
288 | install_device_node_setup root 0600 /usr/share/virtualbox "${usb_group}"
|
---|
289 | %if %{?rpm_redhat:1}%{!?rpm_redhat:0}
|
---|
290 | /sbin/chkconfig --add vboxdrv
|
---|
291 | /sbin/chkconfig --add vboxballoonctrl-service
|
---|
292 | /sbin/chkconfig --add vboxautostart-service
|
---|
293 | /sbin/chkconfig --add vboxweb-service
|
---|
294 | %endif
|
---|
295 | %if %{?rpm_suse:1}%{!?rpm_suse:0}
|
---|
296 | %{fillup_and_insserv -f -y -Y vboxdrv vboxballoonctrl-service vboxautostart-service vboxweb-service}
|
---|
297 | %endif
|
---|
298 | %if %{?rpm_mdv:1}%{!?rpm_mdv:0}
|
---|
299 | /sbin/ldconfig
|
---|
300 | %_post_service vboxdrv
|
---|
301 | %_post_service vboxballoonctrl-service
|
---|
302 | %_post_service vboxautostart-service
|
---|
303 | %_post_service vboxweb-service
|
---|
304 | %update_menus
|
---|
305 | %endif
|
---|
306 | update-mime-database /usr/share/mime &> /dev/null || :
|
---|
307 | update-desktop-database -q > /dev/null 2>&1 || :
|
---|
308 | touch --no-create /usr/share/icons/hicolor
|
---|
309 | gtk-update-icon-cache -q /usr/share/icons/hicolor 2> /dev/null || :
|
---|
310 |
|
---|
311 | # Disable module compilation with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox
|
---|
312 | BUILD_MODULES=0
|
---|
313 | REGISTER_MODULES=1
|
---|
314 | if [ ! -f /lib/modules/`uname -r`/misc/vboxdrv.ko ]; then
|
---|
315 | REGISTER_MODULES=0
|
---|
316 | if [ "$INSTALL_NO_VBOXDRV" != "1" ]; then
|
---|
317 | # compile problem
|
---|
318 | cat << EOF
|
---|
319 | No precompiled module for this kernel found -- trying to build one. Messages
|
---|
320 | emitted during module compilation will be logged to $LOG.
|
---|
321 |
|
---|
322 | EOF
|
---|
323 | BUILD_MODULES=1
|
---|
324 | fi
|
---|
325 | fi
|
---|
326 | # if INSTALL_NO_VBOXDRV is set to 1, remove all shipped modules
|
---|
327 | if [ "$INSTALL_NO_VBOXDRV" = "1" ]; then
|
---|
328 | rm -f /lib/modules/*/misc/vboxdrv.ko
|
---|
329 | rm -f /lib/modules/*/misc/vboxnetflt.ko
|
---|
330 | rm -f /lib/modules/*/misc/vboxnetadp.ko
|
---|
331 | rm -f /lib/modules/*/misc/vboxpci.ko
|
---|
332 | fi
|
---|
333 | if [ $BUILD_MODULES -eq 1 ]; then
|
---|
334 | /etc/init.d/vboxdrv setup || true
|
---|
335 | else
|
---|
336 | if lsmod | grep -q "vboxdrv[^_-]"; then
|
---|
337 | /etc/init.d/vboxdrv stop || true
|
---|
338 | fi
|
---|
339 | if [ $REGISTER_MODULES -eq 1 ]; then
|
---|
340 | DKMS=`which dkms 2>/dev/null`
|
---|
341 | if [ -n "$DKMS" ]; then
|
---|
342 | $DKMS remove -m vboxhost -v %VER% --all > /dev/null 2>&1 || true
|
---|
343 | fi
|
---|
344 | fi
|
---|
345 | /etc/init.d/vboxdrv start > /dev/null
|
---|
346 | fi
|
---|
347 | /etc/init.d/vboxballoonctrl-service start > /dev/null
|
---|
348 | /etc/init.d/vboxautostart-service start > /dev/null
|
---|
349 | /etc/init.d/vboxweb-service start > /dev/null
|
---|
350 |
|
---|
351 |
|
---|
352 | %preun
|
---|
353 | # $1==0: remove the last version of the package
|
---|
354 | # $1==1: install the first time
|
---|
355 | # $1>=2: upgrade
|
---|
356 | %if %{?rpm_suse:1}%{!?rpm_suse:0}
|
---|
357 | %stop_on_removal vboxballoonctrl-service
|
---|
358 | %stop_on_removal vboxautostart-service
|
---|
359 | %stop_on_removal vboxweb-service
|
---|
360 | %endif
|
---|
361 | %if %{?rpm_mdv:1}%{!?rpm_mdv:0}
|
---|
362 | %_preun_service vboxballoonctrl-service
|
---|
363 | %_preun_service vboxautostart-service
|
---|
364 | %_preun_service vboxweb-service
|
---|
365 | %endif
|
---|
366 | %if %{?rpm_redhat:1}%{!?rpm_redhat:0}
|
---|
367 | if [ "$1" = 0 ]; then
|
---|
368 | /sbin/service vboxballoonctrl-service stop > /dev/null
|
---|
369 | /sbin/chkconfig --del vboxballoonctrl-service
|
---|
370 | /sbin/service vboxautostart-service stop > /dev/null
|
---|
371 | /sbin/chkconfig --del vboxautostart-service
|
---|
372 | /sbin/service vboxweb-service stop > /dev/null
|
---|
373 | /sbin/chkconfig --del vboxweb-service
|
---|
374 | fi
|
---|
375 | %endif
|
---|
376 |
|
---|
377 | if [ "$1" = 0 ]; then
|
---|
378 | # check for active VMs
|
---|
379 | VBOXSVC_PID=`pidof VBoxSVC 2>/dev/null || true`
|
---|
380 | if [ -n "$VBOXSVC_PID" ]; then
|
---|
381 | kill -USR1 $VBOXSVC_PID
|
---|
382 | sleep 1
|
---|
383 | if pidof VBoxSVC > /dev/null 2>&1; then
|
---|
384 | echo "A copy of VirtualBox is currently running. Please close it and try again."
|
---|
385 | echo "Please note that it can take up to ten seconds for VirtualBox (in particular"
|
---|
386 | echo "the VBoxSVC daemon) to finish running."
|
---|
387 | exit 1
|
---|
388 | fi
|
---|
389 | fi
|
---|
390 | fi
|
---|
391 | %if %{?rpm_suse:1}%{!?rpm_suse:0}
|
---|
392 | %stop_on_removal vboxdrv
|
---|
393 | %endif
|
---|
394 | %if %{?rpm_mdv:1}%{!?rpm_mdv:0}
|
---|
395 | %_preun_service vboxdrv
|
---|
396 | %endif
|
---|
397 | if [ "$1" = 0 ]; then
|
---|
398 | %if %{?rpm_redhat:1}%{!?rpm_redhat:0}
|
---|
399 | /sbin/service vboxdrv stop > /dev/null
|
---|
400 | /sbin/chkconfig --del vboxdrv
|
---|
401 | %endif
|
---|
402 | rm -f /etc/udev/rules.d/60-vboxdrv.rules
|
---|
403 | rm -f /etc/vbox/license_agreed
|
---|
404 | rm -f /etc/vbox/module_not_compiled
|
---|
405 | fi
|
---|
406 | DKMS=`which dkms 2>/dev/null`
|
---|
407 | if [ -n "$DKMS" ]; then
|
---|
408 | $DKMS remove -m vboxhost -v %VER% --all > /dev/null 2>&1 || true
|
---|
409 | fi
|
---|
410 |
|
---|
411 |
|
---|
412 | %postun
|
---|
413 | %if %{?rpm_redhat:1}%{!?rpm_redhat:0}
|
---|
414 | if [ "$1" -ge 1 ]; then
|
---|
415 | /sbin/service vboxdrv restart > /dev/null 2>&1
|
---|
416 | /sbin/service vboxballoonctrl-service restart > /dev/null 2>&1
|
---|
417 | /sbin/service vboxautostart-service restart > /dev/null 2>&1
|
---|
418 | /sbin/service vboxweb-service restart > /dev/null 2>&1
|
---|
419 | fi
|
---|
420 | %endif
|
---|
421 | %if %{?rpm_suse:1}%{!?rpm_suse:0}
|
---|
422 | %restart_on_update vboxdrv vboxballoonctrl-service vboxautostart-service vboxweb-service
|
---|
423 | %insserv_cleanup
|
---|
424 | %endif
|
---|
425 | %if %{?rpm_mdv:1}%{!?rpm_mdv:0}
|
---|
426 | /sbin/ldconfig
|
---|
427 | %{clean_desktop_database}
|
---|
428 | %clean_menus
|
---|
429 | %endif
|
---|
430 | update-mime-database /usr/share/mime &> /dev/null || :
|
---|
431 | update-desktop-database -q > /dev/null 2>&1 || :
|
---|
432 | touch --no-create /usr/share/icons/hicolor
|
---|
433 | gtk-update-icon-cache -q /usr/share/icons/hicolor 2> /dev/null || :
|
---|
434 | rm -rf /usr/lib/virtualbox/ExtensionPacks
|
---|
435 |
|
---|
436 |
|
---|
437 | %clean
|
---|
438 | rm -rf $RPM_BUILD_ROOT
|
---|
439 |
|
---|
440 |
|
---|
441 | %files
|
---|
442 | %defattr(-,root,root)
|
---|
443 | %doc %{!?is_ose: LICENSE}
|
---|
444 | %doc UserManual*.pdf
|
---|
445 | %doc %{!?is_ose: VirtualBox*.chm}
|
---|
446 | %{_initrddir}/vboxdrv
|
---|
447 | %{_initrddir}/vboxballoonctrl-service
|
---|
448 | %{_initrddir}/vboxautostart-service
|
---|
449 | %{_initrddir}/vboxweb-service
|
---|
450 | %{?rpm_suse: %{py_sitedir}/*}
|
---|
451 | %{!?rpm_suse: %{python_sitelib}/*}
|
---|
452 | %{?rpm_suse: /sbin/rcvboxdrv}
|
---|
453 | %{?rpm_suse: /sbin/rcvboxballoonctrl-service}
|
---|
454 | %{?rpm_suse: /sbin/rcvboxautostart-service}
|
---|
455 | %{?rpm_suse: /sbin/rcvboxweb-service}
|
---|
456 | /etc/vbox
|
---|
457 | /usr/bin/*
|
---|
458 | /usr/src/vbox*
|
---|
459 | /usr/lib/virtualbox
|
---|
460 | /usr/share/applications/*
|
---|
461 | /usr/share/icons/hicolor/*/apps/*
|
---|
462 | /usr/share/icons/hicolor/*/mimetypes/*
|
---|
463 | /usr/share/mime/packages/*
|
---|
464 | /usr/share/pixmaps/*
|
---|
465 | /usr/share/virtualbox
|
---|