VirtualBox

source: vbox/trunk/debian/postinst@ 5861

Last change on this file since 5861 was 5861, checked in by vboxsync, 17 years ago

deb/rpm: Explicitely stop the kernel module before starting the new installed one. Although the deinstaller stops the module itself the user might have loaded a self-brewn module manually.

File size: 2.3 KB
Line 
1#!/bin/sh
2
3LOG="/var/log/vbox-install.log"
4
5# for debconf
6. /usr/share/debconf/confmodule
7db_version 2.0
8
9# remove old cruft
10if [ -f /etc/init.d/vboxdrv.sh ]; then
11 echo "Found old version of /etc/init.d/vboxdrv.sh, removing."
12 rm /etc/init.d/vboxdrv.sh
13 update-rc.d vboxdrv.sh remove >/dev/null
14fi
15if [ -f /etc/init.d/virtualbox ]; then
16 echo "Found old version of /etc/init.d/virtualbox, removing."
17 rm /etc/init.d/virtualbox
18 update-rc.d virtualbox remove >/dev/null
19fi
20
21# install udev rule
22if [ -d /etc/udev/rules.d ]; then
23 udev_out=`udevinfo -V 2> /dev/null`
24 udev_ver=`expr "$udev_out" : '[^0-9]*\([0-9]*\)'`
25 if [ "$udev_ver" = "" -o "$udev_ver" -lt 55 ]; then
26 echo 'KERNEL="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"' \
27 > /etc/udev/rules.d/60-vboxdrv.rules
28 else
29 echo 'KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"' \
30 > /etc/udev/rules.d/60-vboxdrv.rules
31 fi
32fi
33
34# create users groups
35db_input high virtualbox-ose/group-vboxusers || true
36db_go || true
37groupadd -f vboxusers
38
39if [ ! -f /lib/modules/`uname -r`/misc/vboxdrv.ko ]; then
40 db_get virtualbox-ose/module-compilation-allowed
41 if [ "$RET" = "false" ]; then
42 cat << EOF
43Unable to find a precompiled module for the current kernel
44though module compilation denied by debconf setting.
45EOF
46 else
47 db_input critical virtualbox-ose/module-compilation-allowed || true
48 db_go || true
49 db_get virtualbox-ose/module-compilation-allowed
50 if [ "$RET" = "true" ]; then
51 # Compile module. Don't show a message box here if everything works well.
52 cat << EOF
53Messages emitted during module compilation will be logged to $LOG.
54EOF
55 if ! /usr/share/virtualbox-ose/src/build_in_tmp install > /var/log/vbox-install.log 2>&1; then
56 db_fset virtualbox-ose/module-compilation-failed seen false
57 db_input critical virtualbox-ose/module-compilation-failed || true
58 db_go || true
59 touch /etc/vbox/module_not_compiled
60 # don't abort the installation!
61 else
62 # success
63 cat << EOF
64Success!
65EOF
66 rm -f /etc/vbox/module_not_compiled
67 fi
68 fi
69 fi
70fi
71
72# There might be an old module active (e.g. manually loaded)
73if lsmod | grep -q "vboxdrv[^_-]"; then
74 /etc/init.d/vboxdrv stop || true
75fi
76
77#DEBHELPER#
78
79exit 0
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette