docker-entrypoint.sh 586 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/sh
  2. backend=iptables
  3. nft list table ip filter &>/dev/null
  4. nftables_found=$?
  5. iptables -L -n &>/dev/null
  6. iptables_found=$?
  7. if [ $nftables_found -lt $iptables_found ]; then
  8. backend=nftables
  9. fi
  10. if [ $nftables_found -gt $iptables_found ]; then
  11. backend=iptables
  12. fi
  13. if [ $nftables_found -eq 0 ] && [ $nftables_found -eq $iptables_found ]; then
  14. nftables_lines=$(nft list ruleset | wc -l)
  15. iptables_lines=$(iptables-save | wc -l)
  16. if [ $nftables_lines -gt $iptables_lines ]; then
  17. backend=nftables
  18. else
  19. backend=iptables
  20. fi
  21. fi
  22. exec python -u /app/main.py $backend