VirtualBox

source: vbox/trunk/debian/postinst@ 16254

Last change on this file since 16254 was 15823, checked in by vboxsync, 16 years ago

deb: typo (#2983)

File size: 4.2 KB
Line 
1#!/bin/sh
2#
3# Copyright (C) 2006-2007 Sun Microsystems, Inc.
4#
5# This file is part of VirtualBox Open Source Edition (OSE), as
6# available from http://www.virtualbox.org. This file is free software;
7# you can redistribute it and/or modify it under the terms of the GNU
8# General Public License as published by the Free Software Foundation,
9# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
10# distribution. VirtualBox OSE is distributed in the hope that it will
11# be useful, but WITHOUT ANY WARRANTY of any kind.
12#
13
14LOG="/var/log/vbox-install.log"
15
16# for debconf
17. /usr/share/debconf/confmodule
18db_version 2.0
19
20# remove old cruft
21if [ -f /etc/init.d/vboxdrv.sh ]; then
22 echo "Found old version of /etc/init.d/vboxdrv.sh, removing."
23 rm /etc/init.d/vboxdrv.sh
24 update-rc.d vboxdrv.sh remove >/dev/null
25fi
26if [ -f /etc/init.d/virtualbox ]; then
27 echo "Found old version of /etc/init.d/virtualbox, removing."
28 rm /etc/init.d/virtualbox
29 update-rc.d virtualbox remove >/dev/null
30fi
31if [ -f /etc/vbox/vbox.cfg ]; then
32 echo "Found old version of /etc/vbox/vbox.cfg, removing."
33 rm /etc/vbox/vbox.cfg
34fi
35
36# install udev rule
37if [ -d /etc/udev/rules.d ]; then
38 udev_out=`udevinfo -V 2> /dev/null`
39 udev_ver=`expr "$udev_out" : '[^0-9]*\([0-9]*\)'`
40 if [ "$udev_ver" = "" -o "$udev_ver" -lt 55 ]; then
41 echo 'KERNEL="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600"' \
42 > /etc/udev/rules.d/60-vboxdrv.rules
43 else
44 echo 'KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600"' \
45 > /etc/udev/rules.d/60-vboxdrv.rules
46 fi
47fi
48
49# create users groups
50db_input high virtualbox/group-vboxusers || true
51db_go || true
52addgroup --system vboxusers
53
54if [ ! -f /lib/modules/`uname -r`/misc/vboxdrv.ko ]; then
55 db_get virtualbox/module-compilation-allowed
56 if [ "$RET" = "false" ]; then
57 cat << EOF
58Unable to find a precompiled module for the current kernel
59though module compilation denied by debconf setting.
60EOF
61 else
62 db_input critical virtualbox/module-compilation-allowed || true
63 db_go || true
64 db_get virtualbox/module-compilation-allowed
65 if [ "$RET" = "true" ]; then
66 # Compile module. Don't show a message box here if everything works well.
67 cat << EOF
68Messages emitted during module compilation will be logged to $LOG.
69EOF
70 rm -f /etc/vbox/module_not_compiled
71 echo "** Compiling vboxdrv" > /var/log/vbox-install.log
72 if ! /usr/share/virtualbox/src/vboxdrv/build_in_tmp \
73 --save-module-symvers /tmp/vboxdrv-Module.symvers \
74 --no-print-directory KBUILD_VERBOSE= \
75 install >> /var/log/vbox-install.log 2>&1; then
76 db_fset virtualbox/module-compilation-failed seen false
77 db_input critical virtualbox/module-compilation-failed || true
78 db_go || true
79 touch /etc/vbox/module_not_compiled
80 # don't abort the installation!
81 else
82 echo "** Compiling vboxnetflt" >> /var/log/vbox-install.log
83 if ! /usr/share/virtualbox/src/vboxnetflt/build_in_tmp \
84 --use-module-symvers /tmp/vboxdrv-Module.symvers \
85 --no-print-directory KBUILD_VERBOSE= \
86 install >> /var/log/vbox-install.log 2>&1; then
87 db_fset virtualbox/module-compilation-failed seen false
88 db_input critical virtualbox/module-compilation-failed || true
89 db_go || true
90 touch /etc/vbox/module_not_compiled
91 # don't abort the installation!
92 fi
93 fi
94 if [ ! -f /etc/vbox/module_not_compiled ]; then
95 # success
96 cat << EOF
97Success!
98EOF
99 fi
100 fi
101 fi
102fi
103
104# There might be an old module active (e.g. manually loaded)
105if lsmod | grep -q "vboxdrv[^_-]"; then
106 /etc/init.d/vboxdrv stop || true
107fi
108
109# The starters need to be Suid root. They drop the privileges before starting
110# the real frontend.
111if ! dpkg-statoverride --list /usr/lib/virtualbox/VirtualBox > /dev/null 2>&1; then
112 chmod 4711 /usr/lib/virtualbox/VirtualBox
113fi
114if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxHeadless > /dev/null 2>&1; then
115 chmod 4711 /usr/lib/virtualbox/VBoxHeadless
116fi
117if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxSDL > /dev/null 2>&1; then
118 chmod 4711 /usr/lib/virtualbox/VBoxSDL
119fi
120
121#DEBHELPER#
122
123exit 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