#!/usr/bin/perl -w # # Generate a DEBIAN/md5sums file, that lists the md5sums of all files in the # package. use strict; use Cwd; use Debian::Debhelper::Dh_Lib; init(); foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); if (! -d "$tmp/DEBIAN") { doit("install","-d","$tmp/DEBIAN"); } # Check if we should exclude conffiles. my $exclude=""; if (! $dh{INCLUDE} && -r "$tmp/DEBIAN/conffiles") { # Generate exclude regexp. open (CONFF,"$tmp/DEBIAN/conffiles"); while () { chomp; s/^\///; $exclude.="! -path \"$_\" "; } close CONFF; } # See if we should exclude other files. if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') { $exclude.="! \\( $dh{EXCLUDE_FIND} \\) "; } my $olddir=getcwd(); complex_doit("cd $tmp >/dev/null ; find * -type f $exclude ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums ; cd $olddir >/dev/null"); # If the file's empty, no reason to waste inodes on it. if (-z "$tmp/DEBIAN/md5sums") { doit("rm","-f","$tmp/DEBIAN/md5sums"); } else { doit("chmod",644,"$tmp/DEBIAN/md5sums"); doit("chown","0.0","$tmp/DEBIAN/md5sums"); } }