Migrate conditional syntax

set -e doesn't like [ X ] && Y syntax, migrate to if [ X ]; then Y; fi
This commit is contained in:
Jake Guffey 2012-09-19 17:33:42 -04:00
parent 7a67f8bc16
commit 07c5a9b49e

View file

@ -35,11 +35,15 @@ if [ -f "${rcvar}.old" ]; then # rcvar.old exists, we must need to disable pf
# Cleanup
rm -f "${rcvar}.old"
# 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
# Ensure that pf is enabled in the first place
# 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}"
pfctl -e || true
pfctl -f "${rcvar}"