#
SHELL=/bin/bash
+DH_COMPAT=3
-# Name.
package = freeradius
-tmp = $(shell pwd)/debian/tmp
+debiandir = $(shell pwd)/debian
+tmp = $(debiandir)/tmp
prefix = /
exec_prefix = /usr
mandir = $(exec_prefix)/share/man
-pkgdocdir = $(exec_prefix)/share/doc/freeradius
-
-define checkdir
- test -f src/main/radiusd.c
-endef
+libdir = $(exec_prefix)/lib/freeradius
+logdir = /var/log/radiusd-freeradius
+pkgdocdir = $(exec_prefix)/share/doc/radiusd-freeradius
+raddbdir = $(prefix)/etc/raddb
build:
# Builds the binary package.
- $(checkdir)
- ./configure --prefix=$(prefix) --exec-prefix=$(exec_prefix) --mandir=$(mandir) --with-thread-pool --enable-ltdl-install=no
+ dh_testdir
+ # dh_testroot
+ ./configure --prefix=$(prefix) --exec-prefix=$(exec_prefix) --libdir=$(libdir) --mandir=$(mandir) --with-logdir=$(logdir) --with-thread-pool --enable-ltdl-install=no --enable-strict-dependencies
make
touch build
# Architecture independant files.
-binary-indep: build
- $(checkdir)
+binary-indep: build
# Make a binary package (.deb file)
-binary-arch: build checkroot
+binary-arch: build
dh_clean
dh_installdirs
- make install prefix=$(prefix) exec_prefix=$(exec_prefix) mandir=$(mandir) R=$(tmp)
+ make install prefix=$(prefix) exec_prefix=$(exec_prefix) mandir=$(mandir) libdir=$(libdir) R=$(tmp)
# clean up install cruft. $$&@!%
- rmdir $(tmp)/include
- rm $(tmp)/usr/sbin/rc.radiusd
+ rmdir $(tmp)/$(execprefix)/include
+ rm $(tmp)/$(execprefix)/usr/sbin/rc.radiusd
+ # split out inconvenient/controversal modules to other places
+ for modname in krb5 ldap mysql postgresql; do \
+ mkdir -p $(debiandir)/radiusd-freeradius-$${modname}/$(libdir); \
+ mv $(tmp)/$(libdir)/rlm*_$${modname}.* $(debiandir)/radiusd-freeradius-$${modname}/$(libdir)/; \
+ done
# man pages & docs
- find $(tmp)$(mandir) -type f -exec gzip -9 {} \; # policy, sec 6.1
dh_undocumented
- install -g root -m 644 debian/copyright $(tmp)$(pkgdocdir)/copyright # policy, sec 6.6
- install -g root -m 644 debian/TODO $(tmp)$(pkgdocdir)/todo.Debian
- install -g root -m 644 CREDITS $(tmp)$(pkgdocdir)/credits
- for doc in doc/*; do \
- [ -f $$doc -a "$$doc" != doc/Makefile ] && install -g root -m 644 $$doc $(tmp)$(pkgdocdir)/; \
- done
- mv $(tmp)$(pkgdocdir)/ChangeLog $(tmp)$(pkgdocdir)/changelog # policy, sec 6.8
+ install -g root -m 644 CREDITS $(tmp)/$(pkgdocdir)/credits
+ find doc -type f -maxdepth 1 ! -path doc/ChangeLog -exec dh_installdocs {} \;
+ find src/modules/rlm_sql/drivers -type f -name \*.sql -exec dh_installdocs {} \;
+ # dh_installchangelogs doc/ChangeLog
+ dh_compress
# supporting programs
- install -g root -m 755 scripts/rc.radiusd $(tmp)/etc/init.d/radiusd
- install -g root -m 755 scripts/radiusd.cron.daily $(tmp)/etc/cron.daily/radiusd
- install -g root -m 755 scripts/radiusd.cron.monthly $(tmp)/etc/cron.monthly/radiusd
- # fix up conf file -- all of these should be commented on in README.Debian
- cp $(tmp)/etc/raddb/radiusd.conf newconf
- cat newconf \
+ dh_installlogrotate
+ install -g root -m 755 $(debiandir)/initscript $(tmp)/$(prefix)/etc/init.d/freeradius
+ TEMPFILE=`mktemp /tmp/radconf-XXXXXX`; \
+ cp $(tmp)/$(raddbdir)/radiusd.conf $$TEMPFILE; \
+ cat $$TEMPFILE \
| sed -e 's/ / /g' \
- | sed -e 's/ / /g' \
- | sed -e '/^ pam {/,/^ }/s/^/#deb#/' \
- | sed -e 's/^ pam$$/#deb# pam/' \
- | sed -e 's/^ radutmp$$/#deb# radutmp/' \
- | sed -e '/^ example {/,/^ }/s/^/#deb#/' \
- | sed -e '/^ sql .*{/,/^ }/s/^/#deb#/' \
+ | sed -e '/^ example {/,/^ }/s/^/#/' \
| sed -e 's/^ # shadow =/ shadow =/' \
- | sed -e 's/^group = nobody/group = nogroup/' \
- > $(tmp)/etc/raddb/radiusd.conf
- rm newconf
+ | sed -e 's#^\(run_dir = .{localstatedir}/run\)#\1/radiusd#' \
+ | sed -e 's/^group = nobody/group = freerad/' \
+ | sed -e 's/^user = nobody/user = freerad/' \
+ > $(tmp)/$(raddbdir)/radiusd.conf; \
+ rm $$TEMPFILE
#
dh_strip
- dh_installdeb
dh_installchangelogs
- dh_compress
- dh_fixperms
dh_makeshlibs
dh_shlibdeps
+ dh_installdeb
+ dh_compress
+ dh_fixperms
dh_md5sums
dh_gencontrol
dh_builddeb
- dh_clean
-clean: checkroot
+clean:
+ rm -f build debian/{files,substvars} debian/*.debhelper
[ -f Make.inc ] && make distclean || true
- rm -f build debian/{files,substvars}
dh_clean
+ rm -rf $(tmp) radiusd-freeradius-{ldap,postgresql,mysql,krb5}{,.substvars}
binary: binary-indep binary-arch
-checkroot:
- $(checkdir)
- test root = "`whoami`"
+# for the maintainer only
+sanitycheck:
+ @echo -n "sanity: checking for overzealous undocumented file... "
+ @find man/ -type f |grep \. |sed -e 's%man/man./%%' | { \
+ while read manpage; do \
+ grep $$manpage debian/radiusd-freeradius.undocumented | read filename && echo -n $$filename; \
+ done; \
+ } || true
+ @test -n $$filename
+ @echo good.
-.PHONY: binary binary-arch binary-indep clean checkroot
+.PHONY: binary binary-arch binary-indep clean sanitycheck