File: rules

package info (click to toggle)
mailscanner 4.79.11-2.2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 5,820 kB
  • ctags: 1,309
  • sloc: perl: 25,655; sh: 2,666; xml: 624; makefile: 242
file content (145 lines) | stat: -rwxr-xr-x 4,261 bytes parent folder | download
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/usr/bin/make -f
#
# MailScanners debian/rules file
#
# created by Matthias Klose <doko@debian.org>
# modified by Simon Walter <simon.walter@hp-factory.de>

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

p = mailscanner
d = debian/$(p)

DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

build: build-stamp

build-stamp: 
	dh_testdir

	touch build-stamp

clean: 
	dh_testdir
	dh_testroot

	rm -rf bin/tnef*
	rm -rf ../$(shell basename $(CURDIR)).orig/bin/tnef*
	-find . ../$(shell basename $(CURDIR)).orig -name '.#*' | xargs rm -f
	-find . ../$(shell basename $(CURDIR)).orig -type d -empty| xargs rm -rf

	make -C debian/man clean

	dh_clean debian/ucffiles debian/postinst.ucf debian/postrm.ucf
# unnessasary see #467411
#	debconf-updatepo

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	: # tmp directories
	mkdir -p debian/tmp/
	mkdir -p debian/tmp/man/

	make -C debian/man

	pod2man --section=8 bin/upgrade_MailScanner_conf --center=MailScanner \
		> debian/tmp/man/upgrade_MailScanner_conf.8

	: # cleanup
	-find $(d) -name '*[Ss]olaris' | xargs rm -f
	-find $(d) -name CVS | xargs rm -rf
	-find ../ -name svn-commit.tmp | xargs rm -rf

	: # fix virus.scanners.conf
	sed -e 's,/opt/MailScanner/lib/,/etc/MailScanner/wrapper/,g' etc/virus.scanners.conf > debian/tmp/virus.scanners.conf

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installcron
	dh_installdebconf
	dh_installdocs
	dh_installexamples
	dh_installinit
	dh_installlogcheck
	dh_installman
	dh_install -X.old
	dh_compress
	dh_fixperms

	: # fix permissions
	-find $(d)/usr/share/MailScanner/reports -type f | xargs chmod -f a-x
	-find $(d)/usr/share/doc/mailscanner/examples -type f | xargs chmod -f a-x
	chmod a-x $(d)/usr/share/MailScanner/MailScanner/ConfigDefs.pl
	chmod a-x $(d)/usr/share/MailScanner/MailScanner/*.pm
	chmod a-x $(d)/usr/share/MailScanner/MailScanner.pm
	chmod a-x $(d)/etc/MailScanner/CustomConfig.pm
	chmod a-x $(d)/etc/MailScanner/*.conf*
	chmod a-x $(d)/etc/MailScanner/rules/*

	: # #464317 install links after fixing permission to avoid "chmod: cannot operate on dangling symlink"
	dh_link

	: # custom premissions
	chown -f -R mail:mail $(d)/var/lib/MailScanner
	chown -f -R mail:mail $(d)/var/spool/MailScanner
	chmod -f 750 $(d)/var/lib/MailScanner
	chmod -f -R 750 $(d)/var/spool/MailScanner

	: # helper scripts have to be executable
	chmod -f 755 $(d)/etc/MailScanner/autoupdate/*
	chmod -f 755 $(d)/etc/MailScanner/wrapper/*

	: # lintian overrides
	install -m 755 -d $(d)/usr/share/lintian/overrides
	install -m 644 debian/mailscanner.lintian.overrides $(d)/usr/share/lintian/overrides/mailscanner

	: # report files handled by ucf
	find $(d)/usr/share/MailScanner/reports -type f \
	  | sed 's,$(d)/usr/share/,/etc/,' | sed '/For all your IT requirements visit: http:\/\/www.transtec.co.uk/d' > debian/ucffiles

	dh_installdeb
	( \
	  echo 'if [ "$$1" = purge ] && [ -x /usr/bin/ucf ] ; then'; \
	  echo "    ([ ! -c /dev/tty ] || echo Removing report files ... may take some time < /dev/tty >/dev/tty)"; \
	  for f in `cat debian/ucffiles`; do \
	    echo "    ucf --purge --debconf-ok $$f"; \
	  done; \
	  echo 'fi'; \
	) > debian/postrm.ucf

	( \
	  echo 'if [ "$$1" = "configure" ]; then'; \
	  for dir in $$(for f in $$(cat debian/ucffiles); do dirname "$$f" ; done | sort | uniq); do \
	    echo "    mkdir -p $$dir"; \
	  done; \
	  echo "    ([ ! -c /dev/tty ] || echo Checking/installing report files ... < /dev/tty >/dev/tty)"; \
	  for f in `cat debian/ucffiles`; do \
	    f2=`echo $$f | sed s,/etc/MailScanner,/usr/share/MailScanner,`; \
	    echo "    ucf --debconf-ok $$f2 $$f"; \
	  done; \
	  echo 'fi'; \
	) > debian/postinst.ucf

	perl -pi -e '/#UCF#/ and do { open F, "debian/postinst.ucf"; local $$/ ; $$_ = <F> };' $(d)/DEBIAN/postinst
	perl -pi -e '/#UCF#/ and do { open F, "debian/postrm.ucf"; local $$/ ; $$_ = <F> };' $(d)/DEBIAN/postrm

#	dh_perl
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture-dependent files here.
binary-arch: build install
# We have nothing to do by default.

binary: binary-indep binary-arch

.PHONY: build clean binary-indep binary-arch binary install