#!/usr/bin/make -f
# -*- makefile -*-

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

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

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

%:
	dh $@ 

debian/po/templates.pot: debian/shorewall.templates
	@debconf-updatepo

override_dh_auto_configure:
	./configure

override_dh_auto_build:
	true

override_dh_auto_clean:
	rm -rf $(SRWL) shorewallrc

override_dh_install:
	DESTDIR=$(SRWL) BUILD=debian HOST=debian $(CURDIR)/install.sh

override_dh_fixperms:
	# Temporary zones are only available to root
	chmod 750 $(SRWL)/var/lib/shorewall6-lite
	# These should not be executable
	chmod 644 $(SRWL)/etc/shorewall6-lite/shorewall6-lite.conf
	chmod 644 $(SRWL)/etc/shorewall6-lite/Makefile
	# 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
	dh_fixperms -Xetc/shorewall6-lite -Xvar/lib/shorewall6-lite

override_dh_installinit:
	dh_installinit --onlyscripts --no-start -u"start 40 S . stop 89 0 6 ."

override_dh_installman:
	dh_installman manpages/*.5 manpages/*.8

