Debian: Add user to own log files. (User 'nobody' shouldn't own files on
[freeradius.git] / debian / rules
1 #! /usr/bin/make -f
2 #
3 #       debian/rules file for freeradius
4 #
5
6 SHELL=/bin/bash
7
8 package = freeradius
9 tmp     = $(shell pwd)/debian/tmp
10
11 prefix  = /
12 exec_prefix     = /usr
13 mandir  = $(exec_prefix)/share/man
14 libdir  = $(exec_prefix)/lib/freeradius
15 logdir  = /var/log/radiusd-freeradius
16 pkgdocdir       = $(exec_prefix)/share/doc/radiusd-freeradius
17 raddbdir        = $(prefix)/etc/raddb
18
19 build:
20 # Builds the binary package.
21         dh_testdir
22         # dh_testroot
23         ./configure --prefix=$(prefix) --exec-prefix=$(exec_prefix) --libdir=$(libdir) --mandir=$(mandir) --with-logdir=$(logdir) --with-thread-pool --enable-ltdl-install=no --enable-strict-dependencies
24         make
25         touch build
26
27 # Architecture independant files.
28 binary-indep: build
29
30 # Make a binary package (.deb file)
31 binary-arch: build
32         dh_clean
33         dh_installdirs
34         make install prefix=$(prefix) exec_prefix=$(exec_prefix) mandir=$(mandir) libdir=$(libdir) R=$(tmp)
35         # clean up install cruft.  $$&@!%
36         rmdir $(tmp)/$(execprefix)/include
37         rm $(tmp)/$(execprefix)/usr/sbin/rc.radiusd
38         # man pages & docs
39         dh_undocumented 
40         install -g root -m 644 CREDITS $(tmp)/$(pkgdocdir)/credits
41         find doc -type f -maxdepth 1 ! -path doc/ChangeLog -exec dh_installdocs {} \;
42         dh_installchangelogs doc/ChangeLog
43         dh_compress
44         # supporting programs
45         install -g root -m 755 scripts/radiusd.cron.daily $(tmp)/$(prefix)/etc/cron.daily/freeradius
46         install -g root -m 755 scripts/radiusd.cron.monthly $(tmp)/$(prefix)/etc/cron.monthly/freeradius
47         install -g root -m 755 scripts/rc.radiusd $(tmp)/$(prefix)/etc/init.d/freeradius
48         TEMPFILE=`mktemp /tmp/radconf-XXXXXX`
49         cp $(tmp)/$(raddbdir)/radiusd.conf $$TEMPFILE
50         cat $$TEMPFILE \
51                 | sed -e 's/        /   /g' \
52                 | sed -e '/^    example {/,/^   }/s/^/#/' \
53                 | sed -e '/^    always .*{/,/^  }/s/^/#/' \
54                 | sed -e 's/^           #       shadow          =/              shadow          =/' \
55                 | sed -e 's/^group = nobody/group = freerad/' \
56                 | sed -e 's/^user = nobody/user = freerad/' \
57                         > $(tmp)/$(raddbdir)/radiusd.conf
58         rm $$TEMPFILE
59         # 
60         dh_strip
61         dh_installdeb
62         dh_installchangelogs
63         dh_compress
64         dh_fixperms
65         dh_makeshlibs
66         dh_shlibdeps
67         dh_md5sums
68         dh_gencontrol
69         dh_builddeb
70
71 clean:  
72         rm -f build debian/{files,substvars} debian/*.debhelper
73         [ -f Make.inc ] && make distclean || true
74         dh_clean
75         rm -rf $(tmp)
76
77 binary: binary-indep binary-arch
78
79 # for the maintainer only
80 sanitycheck:
81         @echo -n "sanity: checking for overzealous undocumented file... "
82         @find man/ -type f |grep \. |sed -e 's%man/man./%%' | { \
83                 while read manpage; do \
84                         grep $$manpage debian/undocumented | read filename && echo -n $$filename; \
85                 done; \
86         } || true
87         @test -n $$filename
88         @echo good.
89
90         @echo -n "sanity: making sure conffiles lists all raddb files... "
91         @{ \
92                 tree=`find raddb/ -type f |sed -e 's/\.in$$//' |grep -v CVS |grep -v /Makefile |sort |uniq`; \
93                 debconf=`grep raddb debian/conffiles |sed -e 's%/etc/%%' |sort`; \
94                 test "$$tree" = "$$debconf"; \
95         }
96         @echo good.
97
98 .PHONY: binary binary-arch binary-indep clean sanitycheck