William A. Kennington III | c20feb7 | 2021-03-08 12:31:30 -0800 | [diff] [blame] | 1 | #!/bin/bash |
2 | shopt -s nullglob | ||||
3 | declare -A basemap=() | ||||
4 | i=0 | ||||
5 | for dir in /run/nftables /etc/nftables /usr/share/nftables; do | ||||
6 | for file in "$dir"/*.rules; do | ||||
7 | basemap["${file##*/}$i"]="$file" | ||||
8 | done | ||||
9 | let i+=1 | ||||
10 | done | ||||
11 | rc=0 | ||||
12 | for key in $(printf "%s\n" "${!basemap[@]}" | sort -r); do | ||||
13 | echo "Executing ${basemap[$key]}" >&2 | ||||
14 | nft -f "${basemap[$key]}" || rc=$? | ||||
15 | done | ||||
16 | exit $rc |