Skip to content

Commit 6a64a6b

Browse files
committed
add Update-smartdns-cnlist.sh
1 parent 2b23fe6 commit 6a64a6b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

router/Update-smartdns-cnlist.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#! /bin/sh
2+
#
3+
# Update China Domain
4+
# source: https://raw.githubusercontent.com/huifukejian/test/master/update-china-list.sh
5+
6+
# China Domain Download Link
7+
#URL="https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf"
8+
URL="https://dragonuniform.sg/cnlist.php"
9+
10+
# DNS Server Group
11+
PROXYDNS_NAME="china"
12+
13+
# Smartdns Config File Path
14+
CONFIG_FLODER="/etc/smartdns"
15+
CONFIG_FILE="cnlist.conf"
16+
17+
INPUT_FILE=$(mktemp)
18+
OUTPUT_FILE="$CONFIG_FLODER/$CONFIG_FILE"
19+
20+
if [ "$1" != "" ]; then
21+
PROXYDNS_NAME="$1"
22+
fi
23+
24+
wget -O $INPUT_FILE $URL
25+
26+
sed -i "s/^server=\/\(.*\)\/[^\/]*$/nameserver \/\1\/$PROXYDNS_NAME/g;/^nameserver/!d" $INPUT_FILE 2>/dev/null
27+
28+
mv -f $INPUT_FILE $OUTPUT_FILE

0 commit comments

Comments
 (0)