summaryrefslogtreecommitdiff
path: root/dh_md5sums
blob: 5278ed517e78520a7809e5f08d35a4d43a72e3c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh -e
#
# Generate a DEBIAN/md5sums file, that lists the md5sums of all files in the
# package.

PATH=debian:$PATH:/usr/lib/debhelper
. dh_lib

for PACKAGE in $DH_DOPACKAGES; do
	TMP=`tmpdir $PACKAGE`

	if [ ! -d "$TMP/DEBIAN" ]; then
		doit "install -d $TMP/DEBIAN"
	fi

	doit "find $TMP/* -type f ! -regex '^$TMP/DEBIAN/.*' | sed s:$TMP:: | sort > $TMP/DEBIAN/allfiles"
	# Check if we should exclude conffiles.
	if [ ! "$DH_EXCLUDE" -a -r $TMP/DEBIAN/conffiles ]; then
		doit "sort $TMP/DEBIAN/conffiles | comm -13 - $TMP/DEBIAN/allfiles > $TMP/DEBIAN/allfiles.new"
		doit "mv $TMP/DEBIAN/allfiles.new $TMP/DEBIAN/allfiles"
	fi
	doit "cd $TMP ; sed 's:^/::' < DEBIAN/allfiles | xargs md5sum > DEBIAN/md5sums ; cd ../.."
	doit "chown root.root $TMP/DEBIAN/md5sums"
	doit "rm -f $TMP/DEBIAN/allfiles"
done