[Pkg-dkms-maint] Bug#710535: Acknowledgement (dkms: Add option to build for all kernels)

Daniel Dehennin daniel.dehennin at baby-gnu.org
Wed May 7 15:36:28 UTC 2014


Hello,

The patch was not working as expected.

The issue was installing a new kernel version, which is not the latest
and at the same time updating a DKMS package.

I had kernel version K1 and a DKMS version D1.

During an upgrade, I get:

- 2 new kernels
  + the “upstream” linux-image K3
  + our updated one K2, the alphanumeric comparison between K3 and K2
    result in K3 newer than K2

- a upgraded DKMS package D2

As we have code to select our kernels as default ones, with a possible
fallback on “upstream” distribution ones, we would like dkms to build D2
for all kernels:

- the current one K1

- the new “upstream” one K3

- our custom kernel K2

I updated the patch:

- source the framework.conf file in common.postinst to get dkms
  configuration

- rename the variable to “$autoinstall_all_kernels”

- document the new variable in the framework.conf section of the man
  page

- provide the new commented option in configuration file

Regards

The following changes since commit 58ced114e00149af4c7f5af49fd066e8fbed32b9:

  update changelog (2011-12-07 13:30:49 -0600)

are available in the git repository at:

  git://git.baby-gnu.net/dkms.git feature/build-for-all-kernels

for you to fetch changes up to bf6a1be692f9b1549c06a9f371896a0df1aba1b9:

  New option to autoinstall for all kernel versions (2014-05-07 17:34:52 +0200)

----------------------------------------------------------------
Daniel Dehennin (1):
      New option to autoinstall for all kernel versions

 ...on-to-autoinstall-for-all-kernel-versions.patch | 100 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 2 files changed, 101 insertions(+)
 create mode 100644 debian/patches/0001-New-option-to-autoinstall-for-all-kernel-versions.patch

diff --git a/debian/patches/0001-New-option-to-autoinstall-for-all-kernel-versions.patch b/debian/patches/0001-New-option-to-autoinstall-for-all-kernel-versions.patch
new file mode 100644
index 0000000..70c5a04
--- /dev/null
+++ b/debian/patches/0001-New-option-to-autoinstall-for-all-kernel-versions.patch
@@ -0,0 +1,100 @@
+From: Daniel Dehennin <daniel.dehennin at baby-gnu.org>
+Date: Fri, 31 May 2013 19:28:06 +0200
+Subject: New option to autoinstall for all kernel versions
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 8bit
+
+* dkms_common.postinst: Source framework configuration to handle the new
+  option “$autoinstall_all_kernels” to override kernel version
+  detection.
+
+* dkms_framework.conf: Add commented option “$autoinstall_all_kernels”.
+
+* dkms.8: Document the new option “$autoinstall_all_kernels”.
+---
+ dkms.8               | 12 ++++++++++--
+ dkms_common.postinst | 14 ++++++++++++--
+ dkms_framework.conf  |  3 +++
+ 3 files changed, 25 insertions(+), 4 deletions(-)
+
+diff --git a/dkms.8 b/dkms.8
+index 908d9db..278225d 100644
+--- a/dkms.8
++++ b/dkms.8
+@@ -917,8 +917,8 @@ files. Every time after a  dkms.conf file is read, dkms will look for and read t
+ You can use these files to override settings in the module-provided dkms.conf files.
+ .SH /etc/dkms/framework.conf
+ This configuration file controls how the overall DKMS framework handles.  It is sourced
+-in every time the dkms command is run.  Mainly it can currently be used to set different
+-default values for the variables.
++in every time the dkms command or common.postinst script is run.  Mainly it can
++currently be used to set different default values for the variables
+ .B $dkms_tree
+ ,
+ .B $source_tree
+@@ -927,6 +927,14 @@ and
+ which control where DKMS looks for its framework.  Note that these variables can also
+ be manipulated on the command line with \-\-dkmstree, \-\-sourcetree
+ and \-\-installtree options.
++
++The
++.B $autoinstall_all_kernels
++, used by
++.B common.postinst
++script, control if the build must be done for all installed kernels instead of the
++current and latest one, it has no command line equivalent.
++
+ .SH dkms_autoinstaller
+ This boot\-time service automatically installs any module which has
+ .B AUTOINSTALL="yes"
+diff --git a/dkms_common.postinst b/dkms_common.postinst
+index d8cf3a7..1bc716a 100644
+--- a/dkms_common.postinst
++++ b/dkms_common.postinst
+@@ -146,6 +146,10 @@ if [ -z "$NAME" ] || [ -z "$VERSION" ]; then
+     exit 1
+ fi
+ 
++if [ -f /etc/dkms/framework.conf ]; then
++    . /etc/dkms/framework.conf
++fi
++
+ KERNELS=$(ls /lib/modules/)
+ CURRENT_KERNEL=$(uname -r)
+ 
+@@ -189,7 +193,9 @@ fi
+ #
+ # NOTE: if the headers are not installed then the
+ #       module won't be built, as usual
+-if [ -z "$UPGRADE" ]; then
++if [ -n "$autoinstall_all_kernels" ]; then
++    echo "Force build for all kernels..."
++elif [ -z "$UPGRADE" ]; then
+     echo "First Installation: checking all kernels..."
+     for KERNEL in $KERNELS; do
+         if [ ${KERNEL} = ${CURRENT_KERNEL} ]; then
+@@ -211,7 +217,11 @@ NEWEST_KERNEL=$(get_newest_kernel "$KERNELS")
+ if [ `_is_kernel_name_correct $CURRENT_KERNEL` = "yes" ]; then
+     # See if it's worth building the module for both the newest kernel
+     # and for the current kernel
+-    if [ -n "$NEWEST_KERNEL" ] && [ ${CURRENT_KERNEL} != ${NEWEST_KERNEL} ]; then
++    if [ -n "$autoinstall_all_kernels" ]; then
++	# Take care of displaying newline separated list
++	echo "Building for $KERNELS" | tr '\n' ',' \
++	    | sed -e 's/,/, /g; s/, $/\n/; s/, \([^,]\+\)$/ and \1/'
++    elif [ -n "$NEWEST_KERNEL" ] && [ ${CURRENT_KERNEL} != ${NEWEST_KERNEL} ]; then
+         echo "Building for $CURRENT_KERNEL and $NEWEST_KERNEL"
+         KERNELS="$CURRENT_KERNEL $NEWEST_KERNEL"
+     else
+diff --git a/dkms_framework.conf b/dkms_framework.conf
+index fd2cf57..cf27846 100644
+--- a/dkms_framework.conf
++++ b/dkms_framework.conf
+@@ -16,3 +16,6 @@
+ 
+ ## verbosity setting (verbose will be active if you set it to a non-null value)
+ # verbose=""
++
++## Automatic installation and upgrade for all kernels (if you set it to non-null value)
++# autoinstall_all_kernels=""
diff --git a/debian/patches/series b/debian/patches/series
index e69de29..95a2f11 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-New-option-to-autoinstall-for-all-kernel-versions.patch


-- 
Daniel Dehennin
Récupérer ma clef GPG: gpg --recv-keys 0xCC1E9E5B7A6FE2DF
Fingerprint: 3E69 014E 5C23 50E8 9ED6  2AAD CC1E 9E5B 7A6F E2DF
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 359 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-dkms-maint/attachments/20140507/c3744ce8/attachment.sig>


More information about the Pkg-dkms-maint mailing list