从 dnsmasq-china-list 生成 smartdns 格式配置脚本
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
DIR=/etc/smartdns/
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
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
mkdir -p $DIR
cp *.smartdns.conf $DIR
cd /tmp
rm -rf /tmp/dnsmasq-chinalist
/etc/init.d/smartdns restart
echo success