mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-01 12:03:40 +01:00
Remove useless/empty .tmp file when SAVE_IPSETS is set
- Add SAVE_IPSETS support to the Redhat/Fedora sysv init script Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
5e1cf17ebc
commit
e91bd9a0e9
@ -159,8 +159,9 @@ shorewall_stop () {
|
|||||||
|
|
||||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
|
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS" || rm -f "${SAVE_IPSETS}.tmp"
|
||||||
else
|
else
|
||||||
|
rm -f "${SAVE_IPSETS}.tmp"
|
||||||
echo_notdone
|
echo_notdone
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -66,6 +66,10 @@ start () {
|
|||||||
|
|
||||||
printf "Initializing \"Shorewall-based firewalls\": "
|
printf "Initializing \"Shorewall-based firewalls\": "
|
||||||
|
|
||||||
|
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
|
||||||
|
ipset -R < "$SAVE_IPSETS"
|
||||||
|
fi
|
||||||
|
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
setstatedir
|
setstatedir
|
||||||
retval=$?
|
retval=$?
|
||||||
@ -120,6 +124,15 @@ stop () {
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ $retval -eq 0 ]; then
|
if [ $retval -eq 0 ]; then
|
||||||
|
if [ -n "$SAVE_IPSETS" ]; then
|
||||||
|
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||||
|
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||||
|
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS" || rm -f "${SAVE_IPSETS}.tmp"
|
||||||
|
else
|
||||||
|
rm -f "${SAVE_IPSETS}.tmp"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
rm -f $lockfile
|
rm -f $lockfile
|
||||||
success
|
success
|
||||||
else
|
else
|
||||||
|
@ -126,7 +126,9 @@ stop () {
|
|||||||
if [ -n "$SAVE_IPSETS" ]; then
|
if [ -n "$SAVE_IPSETS" ]; then
|
||||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
|
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS" || rm -f "${SAVE_IPSETS}.tmp"
|
||||||
|
else
|
||||||
|
rm -f "${SAVE_IPSETS}.tmp"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,9 @@ shorewall_stop () {
|
|||||||
if [ -n "$SAVE_IPSETS" ]; then
|
if [ -n "$SAVE_IPSETS" ]; then
|
||||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
|
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS" || rm -f "${SAVE_IPSETS}.tmp"
|
||||||
|
else
|
||||||
|
rm -f "${SAVE_IPSETS}.tmp"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -126,7 +126,9 @@ shorewall_stop () {
|
|||||||
if [ -n "$SAVE_IPSETS" ]; then
|
if [ -n "$SAVE_IPSETS" ]; then
|
||||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
|
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS" || rm -f "${SAVE_IPSETS}.tmp"
|
||||||
|
else
|
||||||
|
rm -f "${SAVE_IPSETS}.tmp"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user