1
Improve the logic behind kernels detection.
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
12
NEWEST_KERNEL=$(get_newest_kernel "$KERNELS")
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"
25
+ echo "Building only for $CURRENT_KERNEL"
27
+# The current kernel is not useful as it's the host's
29
- echo "Building only for $CURRENT_KERNEL"
31
+ echo "It is likely that $CURRENT_KERNEL belongs to a chroot's host"
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"
40
if [ -n "$ARCH" ]; then
41
if which lsb_release >/dev/null && [ $(lsb_release -s -i) = "Ubuntu" ]; then