#! /usr/bin/make -f
#
-# debian/rules file for radiusd-cistron
+# debian/rules file for freeradius
#
SHELL=/bin/bash
+DH_COMPAT=3
-# Name.
-package = radiusd-cistron
-tmp = $(shell pwd)/debian/tmp
+package = freeradius
+debiandir = $(shell pwd)/debian
+tmp = $(debiandir)/tmp
-define checkdir
- test -f src/radiusd.c
-endef
+prefix = /
+exec_prefix = /usr
+mandir = $(exec_prefix)/share/man
+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)
- ( cd src && make )
+ 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
- -rm -rf $(tmp)
- install -d -g root -m 755 -o root $(tmp)
- install -d -g root -m 755 -o root $(tmp)/{DEBIAN,usr,etc}
- install -d -g root -m 755 -o root $(tmp)/etc/init.d
- install -d -g root -m 755 -o root $(tmp)/etc/raddb
- install -d -g root -m 755 -o root $(tmp)/usr/{doc,bin,sbin,man}
- install -d -g root -m 755 -o root $(tmp)/usr/man/{man1,man5,man8}
- install -d -g root -m 755 -o root $(tmp)/usr/doc/$(package)
- install -d -g root -m 755 -o root $(tmp)/etc/cron.daily
- install -d -g root -m 755 -o root $(tmp)/etc/cron.monthly
- #
- install -g root -s -m 755 src/radiusd $(tmp)/usr/sbin/radiusd
- install -g root -s -m 755 src/radzap $(tmp)/usr/bin
- install -g root -s -m 755 src/radwho $(tmp)/usr/bin
- install -g root -s -m 755 src/raduse $(tmp)/usr/bin
- install -g root -m 755 src/radlast $(tmp)/usr/bin
- install -g root -s -m 755 src/radtest $(tmp)/usr/bin
- install -g root -m 755 scripts/radwatch $(tmp)/usr/sbin
- install -g root -m 755 src/checkrad.pl $(tmp)/usr/sbin/checkrad
- 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
- perl -pi -e 's#/usr/local/sbin#/usr/sbin#' \
- $(tmp)/usr/sbin/radwatch $(tmp)/etc/init.d/radiusd
- #
- install -g root -m 644 raddb/* $(tmp)/etc/raddb
- chmod 640 $(tmp)/etc/raddb/users
- chmod 640 $(tmp)/etc/raddb/clients
- #
- install -g root -m 644 doc/*.1 $(tmp)/usr/man/man1
- install -g root -m 644 doc/*.5rad $(tmp)/usr/man/man5
- install -g root -m 644 doc/radiusd.8 $(tmp)/usr/man/man8
- install -g root -m 644 doc/radwatch.8 $(tmp)/usr/man/man8
- ##install -g root -m 644 doc/builddbm.8rad $(tmp)/usr/man/man8
- gzip -9f $(tmp)/usr/man/man?/*
- #
- install -g root -m 644 debian/changelog \
- $(tmp)/usr/doc/$(package)/changelog
- install -g root -m 644 doc/README* \
- $(tmp)/usr/doc/$(package)
- gzip -9f $(tmp)/usr/doc/$(package)/*
- cat COPYRIGHT.* > $(tmp)/usr/doc/$(package)/copyright
- chown root:root $(tmp)/usr/doc/$(package)/copyright
- chmod 644 $(tmp)/usr/doc/$(package)/copyright
- #
- install -g root -m 755 debian/postinst $(tmp)/DEBIAN
- install -g root -m 755 debian/prerm $(tmp)/DEBIAN
- install -g root -m 755 debian/postrm $(tmp)/DEBIAN
- install -g root -m 644 debian/conffiles $(tmp)/DEBIAN
- #
- dpkg-shlibdeps src/radiusd
- dpkg-gencontrol
- dpkg --build $(tmp) ..
- rm -rf $(tmp)
+binary-arch: build
+ dh_clean
+ dh_installdirs
+ make install prefix=$(prefix) exec_prefix=$(exec_prefix) mandir=$(mandir) libdir=$(libdir) R=$(tmp)
+ # clean up install cruft. $$&@!%
+ 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
+ dh_undocumented
+ 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
+ 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 '/^ example {/,/^ }/s/^/#/' \
+ | sed -e 's/^ # shadow =/ shadow =/' \
+ | 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_installchangelogs
+ dh_makeshlibs
+ dh_shlibdeps
+ dh_installdeb
+ dh_compress
+ dh_fixperms
+ dh_md5sums
+ dh_gencontrol
+ dh_builddeb
-clean: checkroot
- ( cd src && make clean )
- rm -f build debian/{files,substvars}
- rm -rf $(tmp)
- find . -name '*.bak' -o -name '*~' | xargs -r rm -f --
+clean:
+ rm -f build debian/{files,substvars} debian/*.debhelper
+ [ -f Make.inc ] && make distclean || true
+ 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