#!/usr/bin/make -f
#
# Shorewall firewall (http://www.shorewall.net)
# debianized version

# shorewall version
export V=`grep "^VERSION=" install.sh | head -n 1 | cut -f 2 -d "="`

SRWL=$(CURDIR)/debian/shorewall6-lite

build: build-stamp
build-stamp:
	dh_testdir
# 	there's nothing to compile ;-)
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp
	rm -rf $(SRWL)
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	dh_install

	install -m 644 debian/shorewall6-lite.lintian $(SRWL)/usr/share/lintian/overrides/shorewall6-lite

# 	Temporary zones are only available to root
	chmod 750 $(SRWL)/var/lib/shorewall6-lite
# 	As well as configuration files
	chmod 755 $(SRWL)/etc/shorewall6-lite
	chmod 644 $(SRWL)/etc/shorewall6-lite/shorewall6-lite.conf
	chmod 644 $(SRWL)/etc/shorewall6-lite/Makefile
# 	set version number
	echo $V > $(SRWL)/usr/share/shorewall6-lite/version
#  global configuration has to be fully readable
	chmod 644 $(SRWL)/usr/share/shorewall6-lite/*
#  must be executable
	chmod 755 $(SRWL)/usr/share/shorewall6-lite/shorecap
	chmod 755 $(SRWL)/sbin/shorewall6-lite

binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installman manpages/*.{5,8}
	dh_installdocs releasenotes.txt
	dh_installchangelogs changelog.txt
	dh_installlogrotate
	dh_installinit --no-start -u"start 40 S . stop 89 0 6 ."
	dh_installdebconf
	dh_compress
	dh_fixperms -Xetc/shorewall6-lite -Xvar/lib/shorewall6-lite
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb -v

binary-arch: build install

binary: binary-indep binary-arch

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