# Code to implement plugin support
##################################
# Define path for plugins:
PLUGIN_PATH="/etc/arno-iptables-firewall/plugins"

# Load/insert user plugins
if [ -n "$(find "$PLUGIN_PATH" -maxdepth 1 -name "*.plugin")" ]; then
  echo "Loading (user) plugins:"
  plugin_count=0
  for plugin in "$PLUGIN_PATH"/*.plugin; do
    # Preset ENABLED=0 to make sure the plugin only 
    # gets loaded if the config has an explicit ENABLED=1:
    ENABLED=0

    # Source the plugin:
    . "$plugin"

    # By checking the ENABLED variable, we know whether the plugin
    # was actually loaded. If so increase the plugin count:
    if [ "$ENABLED" = "1" ]; then
      plugin_count=$(($plugin_count + 1))
    fi
  done
  echo " Loaded $plugin_count plugin(s)..."
fi


# Put any custom (iptables) rules here down below:
##################################################
