~ubuntu-branches/ubuntu/natty/virtualbox-ose/natty-updates

« back to all changes in this revision

Viewing changes to src/VBox/HostDrivers/linux/do_dkms

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2010-10-15 02:12:28 UTC
  • mfrom: (0.3.10 upstream) (0.4.19 sid)
  • Revision ID: james.westby@ubuntu.com-20101015021228-5e6vbxgtes8mg189
Tags: 3.2.10-dfsg-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - VirtualBox should go in Accessories, not in System tools.
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook.
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Drop *-source packages.
* Add ubuntu-01-fix-build-gcc45.patch to fix FTBFS due to uninitalized
  variables. Thanks to Lubomir Rintel <lkundrak@v3.sk> for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
#
 
4
# Script to register/build/unregister a kernel module with DKMS.
 
5
#
 
6
# Copyright (C) 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 (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
DKMS=`which dkms 2>/dev/null`
 
18
if [ -n "$DKMS" ]
 
19
then
 
20
    if [ "$1" = "uninstall" ]; then
 
21
 
 
22
        echo "Uninstalling modules from DKMS"
 
23
        for m in _OLDMODULES_
 
24
        do
 
25
            $DKMS status -m $m | while read line
 
26
            # first, remove _any_ old module
 
27
            do
 
28
                if echo "$line" | grep -q added > /dev/null ||
 
29
                   echo "$line" | grep -q built > /dev/null ||
 
30
                   echo "$line" | grep -q installed > /dev/null; then
 
31
                    # either 'vboxvideo, <version>: added' 
 
32
                    # or 'vboxvideo, <version>, ...: installed'
 
33
                    version=`echo "$line" | sed "s/$m,\([^,]*\)[,:].*/\1/;t;d"`
 
34
                    echo "  removing old DKMS module $m version $version"
 
35
                    $DKMS remove -m $m -v $version --all
 
36
                fi
 
37
            done
 
38
        done
 
39
        # there should not be any more matches
 
40
        status=`$DKMS status -m _MODULE_ -v _VERSION_`
 
41
        if echo $status | grep added > /dev/null ||
 
42
            echo $status | grep built > /dev/null ||
 
43
            echo $status | grep installed > /dev/null
 
44
        then
 
45
            $DKMS remove -m _MODULE_ -v _VERSION_ --all
 
46
        fi
 
47
        exit 0
 
48
 
 
49
    elif [ "$1" = "install" ]; then
 
50
 
 
51
        echo "Attempting to install using DKMS"
 
52
        if $DKMS add -m _MODULE_ -v _VERSION_ &&
 
53
            $DKMS build -m _MODULE_ -v _VERSION_ &&
 
54
            $DKMS install -m _MODULE_ -v _VERSION_ --force
 
55
        then
 
56
            exit 0
 
57
        fi
 
58
        echo "Failed to install using DKMS, attempting to install without"
 
59
 
 
60
    fi
 
61
fi
 
62
 
 
63
exit 1