Migrate conditional syntax
set -e doesn't like [ X ] && Y syntax, migrate to if [ X ]; then Y; fi
This commit is contained in:
parent
7a67f8bc16
commit
07c5a9b49e
1 changed files with 6 additions and 2 deletions
|
@ -35,11 +35,15 @@ if [ -f "${rcvar}.old" ]; then # rcvar.old exists, we must need to disable pf
|
||||||
# Cleanup
|
# Cleanup
|
||||||
rm -f "${rcvar}.old"
|
rm -f "${rcvar}.old"
|
||||||
# This file shouldn't exist, but just in case...
|
# This file shouldn't exist, but just in case...
|
||||||
[ -f "${rcvar}" ] && rm -f "${rcvar}"
|
if [ -f "${rcvar}" ]; then
|
||||||
|
rm -f "${rcvar}"
|
||||||
|
fi
|
||||||
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
|
||||||
# If it already is enabled, pfctl -e returns 1, go on with life
|
# If it already is enabled, pfctl -e returns 1, go on with life
|
||||||
[ -f "${rcvar}" ] && rm -f "${rcvar}"
|
if [ -f "${rcvar}" ];
|
||||||
|
rm -f "${rcvar}"
|
||||||
|
fi
|
||||||
mv "${rcvar}.new" "${rcvar}"
|
mv "${rcvar}.new" "${rcvar}"
|
||||||
pfctl -e || true
|
pfctl -e || true
|
||||||
pfctl -f "${rcvar}"
|
pfctl -f "${rcvar}"
|
||||||
|
|
Loading…
Reference in a new issue