~ubuntu-branches/ubuntu/trusty/dkms/trusty-security

« back to all changes in this revision

Viewing changes to debian/patches/skip-non-matching-kernel.patch

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2010-10-25 01:32:41 UTC
  • mfrom: (2.1.13 sid)
  • Revision ID: james.westby@ubuntu.com-20101025013241-cw5ulnje1j2j4rco
Tags: 2.1.1.2-5ubuntu1
* Merge from Debian unstable, remaining changes:
  - debian/control:
    - depend on patch instead of recommending it, if its missing
      the "patches" feature of dkms will no longer work and that
      will cause build failures (LP: #653899)
  - 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
dkms.conf allows to set a BUILD_EXCLUSIVE_KERNEL / BUILD_EXCLUSIVE_ARCH 
 
2
parameter to specify a regular expression which defines the subset of 
 
3
kernels / architectures which DKMS is allowed to build the module for. If 
 
4
the kernel being built for does not match against this regular 
 
5
expressions, the dkms build will error out with exit code 9.
 
6
 
 
7
This patch changes dkms_common.postinst to handle this dkms build 
 
8
error gracefully by skipping build for the non matching kernels.
 
9
--- a/dkms_common.postinst
 
10
+++ b/dkms_common.postinst
 
11
@@ -231,8 +231,22 @@ for KERNEL in $KERNELS; do
 
12
         fi
 
13
         if [ -e /lib/modules/$KERNEL/build/include ]; then
 
14
             echo "Building initial module for $KERNEL"
 
15
+            set +e
 
16
             dkms build -m $NAME -v $VERSION -k $KERNEL $ARCH > /dev/null
 
17
-            echo "Done."
 
18
+            case $? in
 
19
+            9)
 
20
+                set -e
 
21
+                echo "Skipped."
 
22
+                continue
 
23
+                ;;
 
24
+            0)
 
25
+                set -e
 
26
+                echo "Done."
 
27
+                ;;
 
28
+            *)
 
29
+                exit $?
 
30
+                ;;
 
31
+            esac
 
32
             dkms_status=`dkms status -m $NAME -v $VERSION -k $KERNEL $ARCH`
 
33
         else
 
34
             echo "Module build for the currently running kernel was skipped since the"