added makefile and corrected mistake in makeconf script
This commit is contained in:
parent
419683e54d
commit
8f95d74464
|
@ -0,0 +1,25 @@
|
||||||
|
SRC = ./
|
||||||
|
NFT = nftables.conf.nft
|
||||||
|
|
||||||
|
all:
|
||||||
|
$(info run make makeconf to unify .nft files into nftables.conf)
|
||||||
|
$(info run make install to install nftables.conf in /etc and set as current ruleset)
|
||||||
|
$(info run make uninstall to replace /etc/nftables.conf with backup and set as current ruleset)
|
||||||
|
|
||||||
|
makeconf:
|
||||||
|
$(info running makeconf.sh)
|
||||||
|
$(SRC)makeconf.sh
|
||||||
|
|
||||||
|
install: makeconf
|
||||||
|
$(info backing up current nftables rules)
|
||||||
|
cp /etc/nftables.conf $(SRC)backup.conf || nft list ruleset > $(SRC)backup.conf
|
||||||
|
$(info installing new nftables rules)
|
||||||
|
cp $(SRC)$(NFT) /etc/nftables.conf
|
||||||
|
$(info reloading nftables rules)
|
||||||
|
nft -f /etc/nftables.conf
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
$(info replacing nftables.conf with backup)
|
||||||
|
cp $(SRC)backup.conf /etc/nftables.conf
|
||||||
|
$(info reloading nftables rules)
|
||||||
|
nft -f /etc/nftables.conf
|
|
@ -24,6 +24,8 @@ done
|
||||||
|
|
||||||
counter=${counter}-1
|
counter=${counter}-1
|
||||||
mv "${filename}""${counter}".nft nftables.conf
|
mv "${filename}""${counter}".nft nftables.conf
|
||||||
|
counter=${counter}-1
|
||||||
|
|
||||||
while [ ${counter} -ge 0 ]
|
while [ ${counter} -ge 0 ]
|
||||||
do
|
do
|
||||||
rm "${filename}""${counter}".nft
|
rm "${filename}""${counter}".nft
|
||||||
|
|
Loading…
Reference in New Issue