mirror of
https://github.com/bol-van/zapret.git
synced 2024-12-02 22:50:53 +03:00
26 lines
463 B
Bash
Executable File
26 lines
463 B
Bash
Executable File
#!/bin/sh
|
|
# create ipset from resolved ip's
|
|
|
|
SCRIPT=$(readlink -f $0)
|
|
EXEDIR=$(dirname $SCRIPT)
|
|
|
|
. "$EXEDIR/def.sh"
|
|
|
|
TEMPIPSET=/tmp/ipset.$ZIPSET.tmp
|
|
|
|
ipset flush $ZIPSET || ipset create $ZIPSET hash:ip
|
|
|
|
for f in "$ZIPLIST" "$ZIPLIST_USER"
|
|
do
|
|
[ -f $TEMPIPSET ] && rm -f $TEMPIPSET
|
|
[ -n "$f" ] && {
|
|
echo Adding $f
|
|
sort $f | uniq | while read ip;
|
|
do
|
|
echo add $ZIPSET $ip >>$TEMPIPSET
|
|
done
|
|
ipset -! restore <$TEMPIPSET 2>&1
|
|
rm -f $TEMPIPSET
|
|
}
|
|
done
|