]> git.donarmstrong.com Git - debhelper.git/blob - dh_md5sums
r129: Initial Import
[debhelper.git] / dh_md5sums
1 #!/bin/sh -e
2 #
3 # Generate a DEBIAN/md5sums file, that lists the md5sums of all files in the
4 # package.
5
6 PATH=debian:$PATH:/usr/lib/debhelper
7 . dh_lib
8
9 for PACKAGE in $DH_DOPACKAGES; do
10         TMP=`tmpdir $PACKAGE`
11
12         if [ ! -d "$TMP/DEBIAN" ]; then
13                 doit "install -d $TMP/DEBIAN"
14         fi
15
16         # Check if we should exclude conffiles.
17         if [ ! "$DH_INCLUDE" -a -r $TMP/DEBIAN/conffiles ]; then
18                 # Generate exclude regexp. Using perl here may be overkill,
19                 # but it does insure conffiles with spaces in them work.
20                 exclude=`perl -ne 'chomp; s/^\///; print "! -path \"$_\" "' $TMP/DEBIAN/conffiles`
21         fi
22
23         olddir=`pwd`
24         complex_doit "cd $TMP ; find * -type f $exclude ! -regex '^DEBIAN/.*' -print0 | xargs -0 md5sum > DEBIAN/md5sums ; cd $olddir"
25         doit "chmod 644 $TMP/DEBIAN/md5sums"
26         doit "chown root.root $TMP/DEBIAN/md5sums"
27 done