3 # Generate a DEBIAN/md5sums file, that lists the md5sums of all files in the
8 use Debian::Debhelper::Dh_Lib;
11 foreach my $package (@{$dh{DOPACKAGES}}) {
12 my $tmp=tmpdir($package);
14 if (! -d "$tmp/DEBIAN") {
15 doit("install","-d","$tmp/DEBIAN");
18 # Check if we should exclude conffiles.
20 if (! $dh{INCLUDE} && -r "$tmp/DEBIAN/conffiles") {
21 # Generate exclude regexp.
22 open (CONFF,"$tmp/DEBIAN/conffiles");
26 $exclude.="! -path \"$_\" ";
31 # See if we should exclude other files.
32 if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') {
33 $exclude.="! \\( $dh{EXCLUDE_FIND} \\) ";
37 complex_doit("cd $tmp >/dev/null ; find * -type f $exclude ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums ; cd $olddir >/dev/null");
38 # If the file's empty, no reason to waste inodes on it.
39 if (-z "$tmp/DEBIAN/md5sums") {
40 doit("rm","-f","$tmp/DEBIAN/md5sums");
43 doit("chmod",644,"$tmp/DEBIAN/md5sums");
44 doit("chown","0.0","$tmp/DEBIAN/md5sums");