Make 'shorewall save' repeatable

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@1290 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2004-04-29 16:01:00 +00:00
parent 0ec2b0210c
commit d58ef6d813
2 changed files with 8 additions and 7 deletions

View File

@ -5353,9 +5353,9 @@ define_firewall() # $1 = Command (Start or Restart)
save_command 'iptables-restore << EOF'
mv -f /var/lib/shorewall/restore-$$ /var/lib/shorewall/restore-new
mv -f /var/lib/shorewall/restore-$$ /var/lib/shorewall/restore-base
chmod +x /var/lib/shorewall/restore-new
chmod +x /var/lib/shorewall/restore-base
}

View File

@ -966,13 +966,14 @@ case "$1" in
if iptables -L dynamic -n > /var/lib/shorewall/save; then
echo " Dynamic Rules Saved"
if [ -f /var/lib/shorewall/restore-new ]; then
mv -f /var/lib/shorewall/restore-new /var/lib/shorewall/restore
if iptables-save >> /var/lib/shorewall/restore ; then
echo EOF >> /var/lib/shorewall/restore
if [ -f /var/lib/shorewall/restore-base ]; then
cp -f /var/lib/shorewall/restore-base /var/lib/shorewall/restore-$$
if iptables-save >> /var/lib/shorewall/restore-$$ ; then
echo EOF >> /var/lib/shorewall/restore-$$
mv -f /var/lib/shorewall/restore-$$ /var/lib/shorewall/restore
echo " Currently-running Configuration Saved"
else
rm -f /var/lib/shorewall/restore
rm -f /var/lib/shorewall/restore-$$
echo " ERROR: Currently-running Configuration Not Saved"
fi
fi