5
dh_dkms - correctly handle DKMS usage by a kernel module package
10
use Debian::Debhelper::Dh_Lib;
14
B<dh_dkms> [S<I<debhelper options>>] [S<B<-l>>] [S<B<--> I<file>>]
18
dh_dkms is a debhelper program that is responsible for correctly setting
19
postinst, postrm and dependencies in kernel module packages using DKMS.
21
If a file named debian/package.dkms exists, then different actions are
22
performed, depending on its contents.
28
=item debian/I<package>.dkms
32
It can be a proper configuration file, and in this case it would be installed
33
in the proper directory as dkms.conf.
35
It can also point to another file (this should be used when the configuration
36
is provided by upstream), and in this case that file will be installed as dkms.conf
37
in the propery directory.
39
This file can only miss if a filename is provided when calling dh_dkms.
47
=item B<-l>, B<--legacy>
49
Add code to also support DKMS versions < 2.1.0.0.
53
Don't look for debian/I<package>.dkms or debian/dkms, but install I<file> as dkms.conf.
59
Note that this command is not idempotent. L<dh_prep(1)> should be called
60
between invocations of this command. Otherwise, it may cause multiple
61
instances of the same text to be added to maintainer scripts.
66
"l|legacy" => \$dh{LEGACY_DKMS},
69
foreach my $package (@{$dh{DOPACKAGES}}) {
70
#next if is_udeb($package);
72
my $tmp = tmpdir($package);
73
my $dkms_dir = "/usr/lib/dkms/";
74
my $dkms_conf = pkgfile($package, "dkms");
82
# let's see if it's a proper snippet
83
open(IN, "< $dkms_conf");
84
while (my $l = <IN>) {
85
$l =~ /PACKAGE_NAME=(["'])(.*)\1/ && ($is_snippet = 1);
93
@other_conf = filearray($dkms_conf);
94
if ($#other_conf > 1) {
95
error "cannot list more than one file in $dkms_conf!";
98
$name = $other_conf[0];
102
elsif ($#ARGV == 0) {
106
error "doing nothing!";
108
verbose_print "installing $name as dkms.conf";
110
# now, parse our configuration file
112
while (my $l = <IN>) {
113
$l =~ /PACKAGE_NAME=(["'])(.*)\1/ && ($is_snippet = 1 && $package_name = $2);
114
$l =~ /PACKAGE_VERSION=(["'])(.*)\1/ && ($package_version = $2);
118
#$ENV{DH_AUTOSCRIPTDIR} = "debian/scripts/";
119
if ($dh{LEGACY_DKMS}) {
120
doit("install", "-p", "-D", "-m755", "$dkms_dir/common.postinst", "$tmp/usr/share/$package/postinst");
121
addsubstvar($package, "misc:Depends", "dkms");
124
addsubstvar($package, "misc:Depends", "dkms", ">= 2.1.0.0");
127
autoscript($package, "prerm", "prerm-dkms",
128
"s/#MODULE_NAME#/$package_name/;s/#MODULE_VERSION#/$package_version/");
129
autoscript($package, "postinst", "postinst-dkms",
130
"s/#MODULE_NAME#/$package_name/");
131
doit("install", "-p", "-D", "-m644", "$name", "$tmp/usr/src/$package_name-$package_version/dkms.conf");
138
This program is part of the Debian DKMS package.
144
David Paleino <dapal@debian.org>