Last active
March 30, 2022 22:32
-
-
Save highercomve/295cf75fb660be4c6b054627c330cb4b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
NETPLAT=${NETPLAT:-awconnect} | |
IPTABLES_RULESV4_BASENAME=${IPTABLES_RULESV4_BASENAME:-rules.v4} | |
IPTABLES_RULESV6_BASENAME=${IPTABLES_RULESV6_BASENAME:-rules.v6} | |
outdir=$PWD/_config/${NETPLAT}/etc/iptables/ | |
if [ -z "$outdir" ]; then | |
echo "ERROR: need outdir" | |
echo "Usage: $o <outdir>" | |
exit 1 | |
fi | |
temp="/tmp/testing" | |
mkdir -p $temp/private | |
mkdir -p $temp/optional | |
if [ -f bsp/_awall.json ]; then | |
cp -fv bsp/_awall.json $temp/private/bsp.json | |
fi | |
if [ -f awall_bsp.json ]; then | |
cp -fv awall_bsp.json $temp/private/bsp.json | |
fi | |
cp -fv awall.json $temp/ | |
apps=`pvr app ls` | |
for a in $apps; do | |
if ! [ -d $a/_awall ]; then | |
continue | |
fi | |
cp -r $a/_awall/* $temp/ | |
done | |
mkdir -p $outdir || true | |
docker run -v $temp:/etc/awall -v $outdir:/tmp/out -it --rm asac/awall /usr/sbin/awall translate -o /tmp/out/ | |
mv -f $outdir/rules-save $outdir${IPTABLES_RULESV4_BASENAME} | |
mv -f $outdir/rules6-save $outdir${IPTABLES_RULESV6_BASENAME} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment