]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Add initial DKMS support and compress module source with bzip2
authorRuss Allbery <rra@debian.org>
Fri, 13 Feb 2009 01:24:57 +0000 (17:24 -0800)
committerRuss Allbery <rra@debian.org>
Fri, 13 Feb 2009 01:24:57 +0000 (17:24 -0800)
* Add initial DKMS support via an openafs-modules-dkms package, based on
  work by Robert Gerlach.  (LP: #288743)
* Compress the source in openafs-modules-source with bzip2 instead of
  gzip to reduce the package size.

debian/changelog
debian/control
debian/dkms.conf.in [new file with mode: 0644]
debian/openafs-client.init
debian/openafs-modules-dkms.postinst [new file with mode: 0644]
debian/openafs-modules-dkms.prerm [new file with mode: 0644]
debian/rules

index 3e28ed36905a2b59c38ce134ab50c6a42bcf194a..eb6869aeadb30f8d32eb40ba4a3ec091655ec88e 100644 (file)
@@ -21,6 +21,10 @@ openafs (1.4.8.dfsg1-1) UNRELEASED; urgency=low
       could result in reuse of freed memory.
     - STABLE14-rx-do-not-race-current-packet-20090105: fix rx race
       condition.
+  * Add initial DKMS support via an openafs-modules-dkms package, based on
+    work by Robert Gerlach.  (LP: #288743)
+  * Compress the source in openafs-modules-source with bzip2 instead of
+    gzip to reduce the package size.
   * Make dynroot the default for new installations.  It works much better
     with systems that don't bring up their network until late in the boot
     process, such as wireless laptops.  (LP: #249240, #318605)
index 342b658919af6897c1e4e09094319a20ae7f3ddb..19e29d218a4ecddf8f00342295c7b67d49fb5d42 100644 (file)
@@ -114,14 +114,27 @@ Description: AFS distributed filesystem development libraries
 Package: openafs-modules-source
 Priority: extra
 Depends: ${misc:Depends}, bison, flex, debhelper (>= 5),
- kernel-package | module-assistant
+ module-assistant | kernel-package
 Architecture: all
 Description: AFS distributed filesystem kernel module source
  AFS is a distributed filesystem allowing cross-platform sharing of
  files among multiple computers.  Facilities are provided for access
  control, authentication, backup and administrative management.
  .
- This package provides source to the AFS kernel modules.
+ This package provides the source to the AFS kernel module in a form
+ suitable for use by module-assistant or kernel-package.
+
+Package: openafs-modules-dkms
+Priority: extra
+Depends: ${misc:Depends}, bison, flex
+Architecture: all
+Description: AFS distributed filesystem kernel module DKMS source
+ AFS is a distributed filesystem allowing cross-platform sharing of
+ files among multiple computers.  Facilities are provided for access
+ control, authentication, backup and administrative management.
+ .
+ This package contains the source for the AFS kernel module, packaged with
+ approriate configuration for DKMS to build new modules dynamically.
 
 Package: libpam-openafs-kaserver
 Architecture: alpha amd64 arm armel i386 ia64 lpia powerpc ppc64 s390 s390x sparc
diff --git a/debian/dkms.conf.in b/debian/dkms.conf.in
new file mode 100644 (file)
index 0000000..0f0b3d7
--- /dev/null
@@ -0,0 +1,14 @@
+# DKMS configuration for the OpenAFS kernel module.  -*- sh -*-
+
+# The version is replaced at build time by debian/rules.
+PACKAGE_NAME="openafs"
+PACKAGE_VERSION="@VERSION@"
+
+BUILT_MODULE_NAME[0]="$PACKAGE_NAME"
+DEST_MODULE_LOCATION[0]="/updates/dkms/"
+AUTOINSTALL=yes
+
+MAKE[0]="./configure --with-linux-kernel-headers=${kernel_source_dir}
+    && make only_libafs
+    && mv src/libafs/MODLOAD-*/openafs.ko ."
+CLEAN="rm -f openafs.ko && make distclean"
index 69f4a1c951f65103d44d732bc45d8f7f35c0d3e8..e203178432157b20105ffa43cbd4748f0c0971d3 100755 (executable)
@@ -30,6 +30,7 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin
 CACHEINFO=${CACHEINFO:-/etc/openafs/cacheinfo}
 MODULEROOT=${MODULEROOT:-/lib/modules/`uname -r`}
 MODULEDIR=${MODULEDIR:-$MODULEROOT/fs}
+DKMSDIR=${DKMSDIR:-$MODULEROOT/updates/dkms}
 
 exec 3>/dev/null
 exec </dev/null
@@ -65,7 +66,12 @@ choose_client() {
     # exists and this is an SMP system, use it; otherwise, use the default
     # value.  Unset $MP if not using it so that we can use it later in the
     # call to modprobe.
-    if [ -n "$MP" -a -f "$MODULEDIR/openafs${MP}.o" ] ; then
+    #
+    # Assume that if we're using DKMS, we won't have a .mp and we'll always
+    # have a *.ko module name.
+    if [ -f "$DKMSDIR/openafs.ko" ] ; then
+        LIBAFS=openafs.ko
+    elif [ -n "$MP" -a -f "$MODULEDIR/openafs${MP}.o" ] ; then
         LIBAFS=openafs${MP}.o
     elif [ -n "$MP" -a -f "$MODULEDIR/openafs${MP}.ko" ] ; then
         LIBAFS=openafs${MP}.ko
@@ -86,7 +92,7 @@ load_client() {
     if [ -z "$LIBAFS" ] ; then
         choose_client
     fi
-    if [ ! -f "$MODULEDIR/$LIBAFS" ] ; then
+    if [ ! -f "$MODULEDIR/$LIBAFS" ] -a [ ! -f "$DKMSDIR/$LIBAFS" ] ; then
         echo ""
         cat <<EOF >&2
 AFS module $MODULEDIR/$LIBAFS does not exist.
diff --git a/debian/openafs-modules-dkms.postinst b/debian/openafs-modules-dkms.postinst
new file mode 100644 (file)
index 0000000..b7de558
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+set -e
+
+# Get the package version, which is the version of openafs-modules-dkms
+# without the dfsg part and without the Debian version.
+package=openafs-modules-dkms
+version=`dpkg-query -W -f='${Version}' "$package" | sed 's/[.+-].*//'`
+
+dkms add -m openafs -v "$version"
+if [ "$1" = 'configure' ] ; then
+    dkms build -m openafs -v "$version"
+    dkms install -m openafs -v "$version" --force
+fi
+
+#DEBHELPER#
diff --git a/debian/openafs-modules-dkms.prerm b/debian/openafs-modules-dkms.prerm
new file mode 100644 (file)
index 0000000..317d2b7
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+
+# Get the package version, which is the version of openafs-modules-dkms
+# without the dfsg part and without the Debian version.  I hope this is always
+# correct when running prerm and we won't get the new version.
+package=openafs-modules-dkms
+version=`dpkg-query -W -f='${Version}' "$package" | sed 's/[.+-].*//'`
+
+dkms remove -m openafs -v "$version" --all
+
+#DEBHELPER#
index aae96774984c9a17d1cf896ded11b9eabc900270..77530cf047eca23b95011e2f007c7451d4797569 100755 (executable)
@@ -31,6 +31,7 @@ SYS_NAME  := $(shell sh debian/sysname)
 
 package    = openafs
 srcpkg     = openafs-modules-source
+dkmspkg    = openafs-modules-dkms
 
 # The /usr/share/doc directory for these packages should be a symlink to
 # /usr/share/doc/openafs-client.  Any package on this list must depend on
@@ -108,7 +109,9 @@ clean:
            || mv doc/man-pages/pod1/afs-up.pod doc/man-pages/pod1/up.pod
        dh clean
 
-# Rules for building the openafs-modules-source package.
+# Rules for building the openafs-modules-source package.  We generate both a
+# DKMS package and a typical source tarball package usable by
+# module-assistant.
 install-source-stamp:
        dh_testdir
        dh_testroot
@@ -132,11 +135,14 @@ install-source-stamp:
        find debian/$(srcpkg) -type f -perm -100 | xargs chmod 755
        find debian/$(srcpkg) -type f -not -perm -100 | xargs chmod 644
        chmod 775 debian/$(srcpkg)/usr/src/modules
-       cd debian/$(srcpkg)/usr/src && \
-           tar cf $(package).tar modules && \
-           rm -r modules
-       gzip -9 debian/$(srcpkg)/usr/src/$(package).tar
-       chmod 644 debian/$(srcpkg)/usr/src/$(package).tar.gz
+       cd debian/$(srcpkg)/usr/src && tar cf $(package).tar modules
+       bzip2 debian/$(srcpkg)/usr/src/$(package).tar
+       chmod 644 debian/$(srcpkg)/usr/src/$(package).tar.bz2
+       install -d debian/$(dkmspkg)/usr/src
+       mv debian/$(srcpkg)/usr/src/modules/$(package) \
+           debian/$(dkmspkg)/usr/src/openafs-$(VERSION)
+       sed -e 's/[@]VERSION[@]/$(VERSION)' debian/dkms.conf.in \
+           > debian/$(dkmspkg)/usr/src/openafs-$(VERSION)/dkms.conf
        touch $@
 
 install: install-stamp