Evgeni's private DKMS playground

Do not touch until I tell you to!

Prerequisites

  1. You need to create a new binary package your-module-dkms

  2. This package needs a Depends: dkms (>= 1.95)

dkms.conf(.in)

PACKAGE_NAME="your-module"
PACKAGE_VERSION="__VERSION__"
MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build"
CLEAN="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean"
AUTOINSTALL=yes
BUILT_MODULE_NAME[0]="your_module"
DEST_MODULE_LOCATION[0]=/extra

rules

pdkms:=your-module-dkms
sname:=your-module
sversion:=$(shell dpkg-parsechangelog|grep "^Version:"|cut -d" " -f2|rev|cut -d- -f2-|rev|cut -d':' -f2)

install:
        dh_installdirs -p$(pdkms)  usr/src/$(sname)-$(sversion)
        cp -a CHANGES README Makefile *.c *.h debian/$(pdkms)/usr/src/$(sname)-$(sversion)
        sed "s/__VERSION__/$(sversion)/g" debian/dkms.conf.in > debian/$(pdkms)/usr/src/$(sname)-$(sversion)/dkms.conf

postinst

#!/bin/sh

set -e

package=your-module-dkms
name=your-module

version=`dpkg-query -W -f='${Version}' "$package" \
        |rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n"`

isadded=`dkms status -m "$name" -v "$version"`

if [ "x${isadded}" = "x" ] ; then
        dkms add -m "$name" -v "$version"
fi

if [ "$1" = 'configure' ] ; then
        dkms build -m "$name" -v "$version" && dkms install -m "$name" -v "$version" || true
fi

#DEBHELPER#

exit 0

prerm

#!/bin/sh

set -e

package=your-module-dkms
name=your-module

version=`dpkg-query -W -f='${Version}' "$package" \
        |rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n"`

dkms remove -m "$name" -v "$version" --all || true

#DEBHELPER#

exit 0