File: dh_md5sums

package info (click to toggle)
debhelper 1.1.24
  • links: PTS
  • area: main
  • in suites: slink
  • size: 836 kB
  • ctags: 74
  • sloc: perl: 1,037; sh: 681; makefile: 360
file content (27 lines) | stat: -rwxr-xr-x 818 bytes parent folder | download | duplicates (2)
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
26
27
#!/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

	# Check if we should exclude conffiles.
	if [ ! "$DH_INCLUDE" -a -r $TMP/DEBIAN/conffiles ]; then
		# Generate exclude regexp. Using perl here may be overkill,
		# but it does insure conffiles with spaces in them work.
		exclude=`perl -ne 'chomp; s/^\///; print "! -path \"$_\" "' $TMP/DEBIAN/conffiles`
	fi

	olddir=`pwd`
	complex_doit "cd $TMP ; find * -type f $exclude ! -regex '^DEBIAN/.*' -print0 | xargs -0 md5sum > DEBIAN/md5sums ; cd $olddir"
	doit "chmod 644 $TMP/DEBIAN/md5sums"
	doit "chown root.root $TMP/DEBIAN/md5sums"
done