forked from extern/shorewall_code
shorewall6/Makefile: rewrite the Makefile to match shorewall one
Signed-off-by: Tuomo Soini <tis@foobar.fi>
This commit is contained in:
parent
b57c02e0ed
commit
660ae09f4f
@ -1,23 +1,25 @@
|
||||
# Shorewall6 Makefile to restart if config-files are newer than last restart
|
||||
VARDIR=$(shell /sbin/shorewall6 show vardir)
|
||||
CONFDIR=/etc/shorewall6
|
||||
RESTOREFILE?=firewall
|
||||
#
|
||||
# Shorewall6 -- /etc/shorewall6/Makefile
|
||||
#
|
||||
# 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)/*
|
||||
@/sbin/shorewall6 -q save >/dev/null; \
|
||||
if \
|
||||
/sbin/shorewall6 -q restart >/dev/null 2>&1; \
|
||||
then \
|
||||
/sbin/shorewall6 -q save >/dev/null; \
|
||||
.PHONY: clean
|
||||
|
||||
$(SWSTATE): $(CONFDIR)/*
|
||||
@$(SWBIN) save >/dev/null; \
|
||||
RESULT=$$($(SWBIN) reload 2>&1); \
|
||||
if [ $$? -eq 0 ]; then \
|
||||
$(SWBIN) save >/dev/null; \
|
||||
else \
|
||||
/sbin/shorewall6 -q restart 2>&1 | tail >&2; exit 1; \
|
||||
$(SWBIN) restore >/dev/null 2>&1; \
|
||||
echo "$${RESULT}" >&2; \
|
||||
false; \
|
||||
fi
|
||||
|
||||
clean:
|
||||
@rm -f $(CONFDIR)/*~ $(CONFDIR)/.*~
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
# EOF
|
||||
|
Loading…
Reference in New Issue
Block a user