Files
ansible-openwrt-hirkn/templates/openwrt-hirkn.j2
2022-10-16 00:56:50 +04:00

58 lines
1.2 KiB
Django/Jinja

#!/bin/sh /etc/rc.common
START=99
dir=/tmp/lst
SUBNET=https://antifilter.download/list/subnet.lst
IP=https://antifilter.download/list/ip.lst
COMMUNITY=https://community.antifilter.download/list/community.lst
mkdir -p $dir
echo "Run download lists"
{% if download_utility == "curl" %}
curl -z $dir/subnet.lst $SUBNET --output $dir/subnet.lst
curl -z $dir/ip.lst $IP --output $dir/ip.lst
curl -z $dir/community.lst $COMMUNITY --output $dir/community.lst
# Check file at reboot
if [ ! -f $dir/subnet.lst ]
then
curl -z $dir/subnet.lst $SUBNET --output $dir/subnet.lst
fi
if [ ! -f $dir/ip.lst ]
then
curl -z $dir/ip.lst $IP --output $dir/ip.lst
fi
if [ ! -f $dir/community.lst ]
then
curl -z $dir/community.lst $COMMUNITY --output $dir/community.lst
fi
{% elif download_utility == "wget" %}
rm -f /$dir/subnet.lst && wget -P $dir $SUBNET
rm -f /$dir/ip.lst && wget -P $dir $IP
rm -f /$dir/community.lst && wget -P $dir $COMMUNITY
# Check file at reboot
if [ ! -f $dir/subnet.lst ]
then
wget -P $dir $SUBNET
fi
if [ ! -f $dir/ip.lst ]
then
wget -P $dir $IP
fi
if [ ! -f $dir/community.lst ]
then
wget -P $dir $COMMUNITY
fi
{% endif %}
echo "Firewall restart"
/etc/init.d/firewall restart