firewall-cmd --state returns 0 on 'running' non 0 on 'not running',

so check retval and not text returned.

FirewallD conversion to multicall

IPTables test
This commit is contained in:
Dan Schaper 2017-01-24 15:44:48 -08:00
parent 4bb71ae046
commit b16f797317
No known key found for this signature in database
GPG key ID: 572E999E385B7BFC
2 changed files with 28 additions and 22 deletions

View file

@ -879,7 +879,7 @@ create_pihole_user() {
configureFirewall() {
# Allow HTTP and DNS traffic
if [[ $(firewall-cmd --state) == "running" ]]; then
if firewall-cmd --state &> /dev/null; then
whiptail --title "Firewall in use" --yesno "We have detected a running firewall\n\nPi-hole currently requires HTTP and DNS port access.\n\n\n\nInstall Pi-hole default firewall rules?" ${r} ${c} || \
{ echo -e ":::\n::: Not installing firewall rulesets."; return 1; }
echo -e ":::\n:::\n Configuring FirewallD for httpd and dnsmasq."