shorewall6/Makefile: rewrite the Makefile to match shorewall one

Signed-off-by: Tuomo Soini <tis@foobar.fi>
This commit is contained in:
Tuomo Soini 2016-02-12 12:20:28 +02:00
parent b57c02e0ed
commit 660ae09f4f

View File

@ -1,23 +1,25 @@
# Shorewall6 Makefile to restart if config-files are newer than last restart #
VARDIR=$(shell /sbin/shorewall6 show vardir) # Shorewall6 -- /etc/shorewall6/Makefile
CONFDIR=/etc/shorewall6 #
RESTOREFILE?=firewall # Reload Shorewall6 if config files are updated.
# If reloading fails, restore old settings.
all: $(VARDIR)/$(RESTOREFILE) SWBIN ?= /sbin/shorewall6 -q
CONFDIR ?= /etc/shorewall6
SWSTATE ?= $(shell $(SWBIN) show vardir)/firewall
$(VARDIR)/$(RESTOREFILE): $(CONFDIR)/* .PHONY: clean
@/sbin/shorewall6 -q save >/dev/null; \
if \ $(SWSTATE): $(CONFDIR)/*
/sbin/shorewall6 -q restart >/dev/null 2>&1; \ @$(SWBIN) save >/dev/null; \
then \ RESULT=$$($(SWBIN) reload 2>&1); \
/sbin/shorewall6 -q save >/dev/null; \ if [ $$? -eq 0 ]; then \
$(SWBIN) save >/dev/null; \
else \ else \
/sbin/shorewall6 -q restart 2>&1 | tail >&2; exit 1; \ $(SWBIN) restore >/dev/null 2>&1; \
echo "$${RESULT}" >&2; \
false; \
fi fi
clean: clean:
@rm -f $(CONFDIR)/*~ $(CONFDIR)/.*~ @rm -f $(CONFDIR)/*~ $(CONFDIR)/.*~
.PHONY: clean
# EOF