~ubuntu-branches/ubuntu/precise/dkms/precise-security

« back to all changes in this revision

Viewing changes to debian/patches/improve-the-logic-behind-kernels-detection.patch

  • Committer: Bazaar Package Importer
  • Author(s): Alberto Milone
  • Date: 2010-09-23 18:59:55 UTC
  • Revision ID: james.westby@ubuntu.com-20100923185955-rzzs9ajvtrrnrm5k
Tags: 2.1.1.2-3ubuntu1
* debian/patches/improve-the-logic-behind-kernels-detection.patch:
  - Before using the current kernel we need to make sure that this
    kernel doesn't belong to the host of a chroot and we should
    also be more careful when adding kernels to the candidates
    list (LP: #602408).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Improve the logic behind kernels detection.
 
2
 
 
3
Before using the current kernel we need to make sure that this
 
4
kernel doesn't belong to the host of a chroot and we should also
 
5
be more careful when adding kernels to the candidates list.
 
6
Index: dkms-2.1.1.2/dkms_common.postinst
 
7
===================================================================
 
8
--- dkms-2.1.1.2.orig/dkms_common.postinst      2010-09-23 18:56:55.119898998 +0200
 
9
+++ dkms-2.1.1.2/dkms_common.postinst   2010-09-23 18:58:03.579898998 +0200
 
10
@@ -188,13 +188,26 @@
 
11
 # current kernel.
 
12
 NEWEST_KERNEL=$(get_newest_kernel "$KERNELS")
 
13
 
 
14
-if [ -n "$NEWEST_KERNEL" ] && [ ${CURRENT_KERNEL} != ${NEWEST_KERNEL} ]; then
 
15
-    echo "Building for $CURRENT_KERNEL and $NEWEST_KERNEL"
 
16
-    KERNELS="$KERNELS $NEWEST_KERNEL"
 
17
+# If the current kernel doesn't come from the host of a chroot
 
18
+if [ `_is_kernel_name_correct $CURRENT_KERNEL` = "yes" ]; then
 
19
+    # See if it's worth building the module for both the newest kernel
 
20
+    # and for the current kernel
 
21
+    if [ -n "$NEWEST_KERNEL" ] && [ ${CURRENT_KERNEL} != ${NEWEST_KERNEL} ]; then
 
22
+        echo "Building for $CURRENT_KERNEL and $NEWEST_KERNEL"
 
23
+        KERNELS="$CURRENT_KERNEL $NEWEST_KERNEL"
 
24
+    else
 
25
+        echo "Building only for $CURRENT_KERNEL"
 
26
+    fi
 
27
+# The current kernel is not useful as it's the host's
 
28
 else
 
29
-    echo "Building only for $CURRENT_KERNEL"
 
30
-fi
 
31
+    echo "It is likely that $CURRENT_KERNEL belongs to a chroot's host"
 
32
 
 
33
+    # Let's use only the newest kernel
 
34
+    if [ -n "$NEWEST_KERNEL" ]; then
 
35
+        KERNELS="$NEWEST_KERNEL"
 
36
+        echo "Building only for $NEWEST_KERNEL"
 
37
+    fi
 
38
+fi
 
39
 
 
40
 if [ -n "$ARCH" ]; then
 
41
     if which lsb_release >/dev/null && [ $(lsb_release -s -i) = "Ubuntu" ]; then