blob: 05bb23d8b714ef69c62a777f6294942851e57511 [file] [log] [blame]
William A. Kennington IIIc20feb72021-03-08 12:31:30 -08001#!/bin/bash
2shopt -s nullglob
3declare -A basemap=()
4i=0
5for 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
10done
11rc=0
William A. Kennington IIIcbb15ab2021-03-12 18:19:01 -080012nft flush ruleset || rc=$?
William A. Kennington IIIc20feb72021-03-08 12:31:30 -080013for key in $(printf "%s\n" "${!basemap[@]}" | sort -r); do
14 echo "Executing ${basemap[$key]}" >&2
15 nft -f "${basemap[$key]}" || rc=$?
16done
17exit $rc