forked from ungleich-public/cdist
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:
parent
08aa7d8e83
commit
995265d4a6
1 changed files with 4 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue