OpenWrt/Scripts/dnsmasq-china-list-update-smartdns

根据 dnsmasq-china-list 生成 smartdns 格式的配置文件放到 /etc/smartdns/ 目录里。

/usr/bin/dnsmasq-china-list-update-smartdns

#!/bin/sh

# add the following lines to smartdns conf file (eg. /etc/smartdns/custom.conf):
#
# server 114.114.114.114 -group cn -exclude-default-group
# conf-file /etc/smartdns/accelerated-domains.china.smartdns.conf
# conf-file /etc/smartdns/google.china.smartdns.conf
# conf-file /etc/smartdns/apple.china.smartdns.conf
#

SERVER=cn

mkdir /tmp/dnsmasq-chinalist
cd /tmp/dnsmasq-chinalist
wget https://github.com/felixonmars/dnsmasq-china-list/archive/master.zip -O master.zip
unzip -o master.zip

if [ $? -ne 0 ]
then
  exit
fi

cd dnsmasq-china-list-master
mkdir /etc/smartdns
sed -e "s|server=\/\(.*\)\/.*|nameserver /\1/$SERVER|" accelerated-domains.china.conf > accelerated-domains.china.smartdns.conf
sed -e "s|server=\/\(.*\)\/.*|nameserver /\1/$SERVER|" google.china.conf > google.china.smartdns.conf
sed -e "s|server=\/\(.*\)\/.*|nameserver /\1/$SERVER|" apple.china.conf > apple.china.smartdns.conf

cp *.smartdns.conf /etc/smartdns/
cd /tmp
rm -rf /tmp/dnsmasq-chinalist
echo success

Last update: 2020-05-25 08:25:45 UTC