shorewall/Makefile: fix logics so you get error from reload

Signed-off-by: Tuomo Soini <tis@foobar.fi>
This commit is contained in:
Tuomo Soini 2016-02-12 12:19:25 +02:00
parent 865a397207
commit b57c02e0ed

View File

@ -1,23 +1,25 @@
# Shorewall Makefile to restart if config-files are newer than last restart #
VARDIR=$(shell /sbin/shorewall show vardir) # Shorewall -- /etc/shorewall/Makefile
CONFDIR=/etc/shorewall #
RESTOREFILE?=firewall # Reload Shorewall if config files are updated.
# If reloading fails, restore old settings.
all: $(VARDIR)/$(RESTOREFILE) SWBIN ?= /sbin/shorewall -q
CONFDIR ?= /etc/shorewall
SWSTATE ?= $(shell $(SWBIN) show vardir)/firewall
$(VARDIR)/$(RESTOREFILE): $(CONFDIR)/* .PHONY: clean
@/sbin/shorewall -q save >/dev/null; \
if \ $(SWSTATE): $(CONFDIR)/*
/sbin/shorewall -q reload >/dev/null 2>&1; \ @$(SWBIN) save >/dev/null; \
then \ RESULT=$$($(SWBIN) reload 2>&1); \
/sbin/shorewall -q save >/dev/null; \ if [ $$? -eq 0 ]; then \
$(SWBIN) save >/dev/null; \
else \ else \
/sbin/shorewall -q restore 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