firewall: show error message only on actual error

This commit is contained in:
Marek Marczykowski-Górecki 2014-09-03 09:59:59 +02:00
parent 1a712c3a4a
commit 41f65f1f5a

View File

@ -41,11 +41,13 @@ while true; do
for i in $(xenstore-list qubes-iptables-domainrules) ; do
RULES=$(/usr/bin/xenstore-read qubes-iptables-domainrules/"$i")
ERRS=`echo -e "$RULES" | /sbin/iptables-restore -n 2>&1 || true`
echo "Failed applying rules for $i: $ERRS" >&2
OUT="$OUT$ERRS"
if [ -n "$ERRS" ]; then
echo "Failed applying rules for $i: $ERRS" >&2
OUT="$OUT$ERRS"
fi
done
/usr/bin/xenstore-write $XENSTORE_ERROR "$OUT"
if [ "$OUT" ]; then
if [ -n "$OUT" ]; then
DISPLAY=:0 /usr/bin/notify-send -t 3000 "Firewall loading error ($HOSTNAME)" "$OUT" || :
fi