You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
434 B

  1. #!/bin/sh
  2. # unfortunately, UCI doesn't provide a nice way to add an anonymous section only if it doesn't already exist
  3. if ! uci show firewall | grep -q firewall.fail2ban; then
  4. name="$(uci add firewall include)"
  5. uci set "firewall.${name}.path=/etc/firewall.fail2ban"
  6. uci set "firewall.${name}.enabled=1"
  7. uci set "firewall.${name}.reload=1"
  8. echo -e "Adding the following UCI config:\n $(uci changes)"
  9. uci commit
  10. fi
  11. exit 0