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 |
William A. Kennington III | cbb15ab | 2021-03-12 18:19:01 -0800 | [diff] [blame^] | 12 | nft flush ruleset || rc=$? |
William A. Kennington III | c20feb7 | 2021-03-08 12:31:30 -0800 | [diff] [blame] | 13 | for key in $(printf "%s\n" "${!basemap[@]}" | sort -r); do |
| 14 | echo "Executing ${basemap[$key]}" >&2 |
| 15 | nft -f "${basemap[$key]}" || rc=$? |
| 16 | done |
| 17 | exit $rc |