-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathHandles.sh
55 lines (39 loc) · 2.31 KB
/
Handles.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
PKG_PATCH="$GITHUB_WORKSPACE/wrt/package/"
#预置HomeProxy数据
if [ -d *"homeproxy"* ]; then
HP_RULES="surge"
HP_PATCH="homeproxy/root/etc/homeproxy"
chmod +x ./$HP_PATCH/scripts/*
rm -rf ./$HP_PATCH/resources/*
git clone -q --depth=1 --single-branch --branch "release" "https://github.com/Loyalsoldier/surge-rules.git" ./$HP_RULES/
cd ./$HP_RULES/ && RES_VER=$(git log -1 --pretty=format:'%s' | grep -o "[0-9]*")
echo $RES_VER | tee china_ip4.ver china_ip6.ver china_list.ver gfw_list.ver
awk -F, '/^IP-CIDR,/{print $2 > "china_ip4.txt"} /^IP-CIDR6,/{print $2 > "china_ip6.txt"}' cncidr.txt
sed 's/^\.//g' direct.txt > china_list.txt ; sed 's/^\.//g' gfw.txt > gfw_list.txt
mv -f ./{china_*,gfw_list}.{ver,txt} ../$HP_PATCH/resources/
cd .. && rm -rf ./$HP_RULES/
cd $PKG_PATCH && echo "homeproxy date has been updated!"
fi
#预置OpenClash内核和数据
if [ -d *"OpenClash"* ]; then
CORE_VER="https://raw.githubusercontent.com/vernesong/OpenClash/core/dev/core_version"
CORE_TYPE=$(echo $WRT_TARGET | egrep -iq "64|86" && echo "amd64" || echo "arm64")
CORE_TUN_VER=$(curl -sfL $CORE_VER | sed -n "2{s/\r$//;p;q}")
#CORE_MASTER="https://github.com/vernesong/OpenClash/raw/core/dev/dev/clash-linux-$CORE_TYPE.tar.gz"
CORE_MATE="https://github.com/vernesong/OpenClash/raw/core/dev/meta/clash-linux-$CORE_TYPE.tar.gz"
#CORE_TUN="https://github.com/vernesong/OpenClash/raw/core/dev/premium/clash-linux-$CORE_TYPE-$CORE_TUN_VER.gz"
GEO_MMDB="https://github.com/alecthw/mmdb_china_ip_list/raw/release/lite/Country.mmdb"
#GEO_SITE="https://github.com/Loyalsoldier/v2ray-rules-dat/raw/release/geosite.dat"
#GEO_IP="https://github.com/Loyalsoldier/v2ray-rules-dat/raw/release/geoip.dat"
cd ./OpenClash/luci-app-openclash/root/etc/openclash/
curl -sL -o Country.mmdb $GEO_MMDB && echo "Country.mmdb done!"
#curl -sL -o GeoSite.dat $GEO_SITE && echo "GeoSite.dat done!"
#curl -sL -o GeoIP.dat $GEO_IP && echo "GeoIP.dat done!"
mkdir ./core/ && cd ./core/
curl -sL -o meta.tar.gz $CORE_MATE && tar -zxf meta.tar.gz && mv -f clash clash_meta && echo "meta done!"
#curl -sL -o tun.gz $CORE_TUN && gzip -d tun.gz && mv -f tun clash_tun && echo "tun done!"
#curl -sL -o dev.tar.gz $CORE_DEV && tar -zxf dev.tar.gz && echo "dev done!"
chmod +x ./clash* && rm -rf ./*.gz
echo "openclash date has been updated!"
fi