[PATCH] dkms: add PRE_INSTALL= dkms.conf directive

Matt Domsch Matt_Domsch at dell.com
Wed Mar 15 21:23:19 CST 2006


Add PRE_INSTALL= dkms.conf directive

Modules may specify PRE_INSTALL= in dkms.conf to cause a custom script
to be run.  If the script exits with a non-zero value, then the
install will be aborted (unless --force is used).  This is typically
used to cause a custom version checking script to be run.

In particular, on RHEL3 and RHEL4 < U3, DKMS cannot automatically
determine if a to-be-installed module is a newer or older version.
The version test is module-specific (strings | grep on the module
.{o,ko}).  This enables behavior consistent with RHEL4 U3 and SLES9,
where 'dkms install' will abort if trying to install a down-rev
module, unless --force is used.

The consumer of such a field will first be the openipmi driver
packages I've created.  

Please review and comment.

-- 
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com




Index: SOURCES/dkms
===================================================================
--- SOURCES.orig/dkms	2006-03-14 16:19:23.%N -0600
+++ SOURCES/dkms	2006-03-15 21:18:12.%N -0600
@@ -273,6 +273,7 @@
     POST_INSTALL=""
     POST_REMOVE=""
     PRE_BUILD=""
+    PRE_INSTALL=""
     BUILD_EXCLUSIVE_KERNEL=""
     BUILD_EXCLUSIVE_ARCH=""
     build_exclude=""
@@ -337,6 +338,7 @@
     post_install="$POST_INSTALL"
     post_remove="$POST_REMOVE"
     pre_build="$PRE_BUILD"
+    pre_install="$PRE_INSTALL"
 
     # Set module naming/location arrays
     local index=0
@@ -945,6 +947,18 @@
 
     # Check this version against what is already in the kernel
     check_version_sanity "${kernelver_array[0]}" "${arch_array[0]}"
+
+    # Run the pre_install script
+    if [ -n "$pre_install" ] && [ -x `echo "$dkms_tree/$module/$module_version/source/$pre_install" | sed 's/ .*//'` ]; then
+	echo $""
+	echo $"Running the pre_install script:"
+	$dkms_tree/$module/$module_version/source/$pre_install
+	if [ "$?" -ne 0 -a -z "$force" ]; then
+	    echo $"pre_install failed, aborting install." >&2
+	    echo $"You may override by specifying --force." >&2
+	    exit 101
+	fi
+    fi
 
     # Save the original_module if one exists, none have been saved before, and this is the first module for this kernel
     local lib_tree="$install_tree/${kernelver_array[0]}"
Index: SOURCES/dkms.8
===================================================================
--- SOURCES.orig/dkms.8	2006-03-14 16:56:40.%N -0600
+++ SOURCES/dkms.8	2006-03-15 11:03:04.%N -0600
@@ -1,5 +1,5 @@
 .\" -*- nroff -*-
-.TH DKMS 8 "Mar 2006" "Version 2.0.9.2"
+.TH DKMS 8 "Mar 2006" "Version 2.0.9.3"
 .SH NAME
 dkms \- Dynamic Kernel Module Support
 .SH SYNOPSIS
@@ -628,6 +628,14 @@
 The name of the script to be run before a
 .B build
 is performed. The path should be given relative to the root directory of your source.
+.TP
+.B PRE_INSTALL=
+The name of the script to be run before an
+.B install
+is performed. The path should be given relative to the root directory
+of your source.  If the script exits with a non-zero value, the
+install will be aborted.  This is typically used to perform a custom
+version comparison.
 .TP
 .SH DKMS.CONF VARIABLES
 Within your 



More information about the DKMS-devel mailing list