Allow pfctl -[de] to return 1

If pf is already enabled or disabled and we try to enable/disable it again, it returns 1.
This commit is contained in:
Jake Guffey 2012-09-19 16:42:15 -04:00
parent 08aa7d8e83
commit 995265d4a6

View file

@ -29,6 +29,8 @@ rcvar=$(cat "$__object/explorer/rcvar")
cat <<EOF cat <<EOF
if [ -f "${rcvar}.old" ]; then # rcvar.old exists, we must need to disable pf if [ -f "${rcvar}.old" ]; then # rcvar.old exists, we must need to disable pf
# Disable pf
# If it already is disabled, pfctl -d returns 1, go on with life
pfctl -d pfctl -d
# Cleanup # Cleanup
rm -f "${rcvar}.old rm -f "${rcvar}.old
@ -36,7 +38,8 @@ if [ -f "${rcvar}.old" ]; then # rcvar.old exists, we must need to disable pf
[ -f "${rcvar}" ] && rm -f "${rcvar}" [ -f "${rcvar}" ] && rm -f "${rcvar}"
elif [ -f "${rcvar}.new" ]; then # rcvar.new exists, we must need to apply it elif [ -f "${rcvar}.new" ]; then # rcvar.new exists, we must need to apply it
# Ensure that pf is enabled in the first place # Ensure that pf is enabled in the first place
pfctl -e # If it already is enabled, pfctl -e returns 1, go on with life
pfctl -e || true
pfctl -f "${rcvar}" pfctl -f "${rcvar}"
ret="$?" ret="$?"
# Cleanup # Cleanup