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