VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/linux/do_dkms@ 41268

Last change on this file since 41268 was 39358, checked in by vboxsync, 13 years ago

Installers/linux: make do_dkms take arguments instead of requiring patching.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
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
17ACTION=
18if [ "$1" = "install" ]; then
19 ACTION="install"
20 MODULE="$2"
21 VERSION="$3"
22elif [ "$1" = "uninstall" ]; then
23 shift
24 ACTION="uninstall"
25 OLDMODULES="$*"
26 break
27fi
28
29DKMS=`which dkms 2>/dev/null`
30if [ -n "$DKMS" ]
31then
32 if [ "$ACTION" = "uninstall" ]; then
33
34 echo "Uninstalling modules from DKMS"
35 for m in $OLDMODULES
36 do
37 $DKMS status -m $m | while read line
38 # first, remove _any_ old module
39 do
40 if echo "$line" | grep -q added > /dev/null ||
41 echo "$line" | grep -q built > /dev/null ||
42 echo "$line" | grep -q installed > /dev/null; then
43 # either 'vboxvideo, <version>: added'
44 # or 'vboxvideo, <version>, ...: installed'
45 version=`echo "$line" | sed "s/$m,\([^,]*\)[,:].*/\1/;t;d"`
46 echo " removing old DKMS module $m version $version"
47 $DKMS remove -m $m -v $version --all
48 fi
49 done
50 done
51 exit 0
52
53 elif [ "$ACTION" = "install" ]; then
54
55 echo "Attempting to install using DKMS"
56 if $DKMS add -m $MODULE -v $VERSION &&
57 $DKMS build -m $MODULE -v $VERSION &&
58 $DKMS install -m $MODULE -v $VERSION --force
59 then
60 exit 0
61 fi
62 echo "Failed to install using DKMS, attempting to install without"
63
64 fi
65fi
66
67exit 1
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