forked from MetaCubeX/ClashX.Meta
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall_dependency.sh
More file actions
executable file
·79 lines (68 loc) · 2.54 KB
/
install_dependency.sh
File metadata and controls
executable file
·79 lines (68 loc) · 2.54 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -e
if [ ! -d "clash.meta" ]; then
echo "Downloading mihomo..."
mkdir clash.meta
# arm64
curl -s https://api.github.com/repos/MetaCubeX/mihomo/releases/latest \
| grep "browser_download_url.*mihomo-darwin-arm64-v.*gz" \
| cut -d '"' -f 4 \
| xargs curl -L -o clash.meta/mihomo-darwin-arm64.gz
# amd64
curl -s https://api.github.com/repos/MetaCubeX/mihomo/releases/latest \
| grep "browser_download_url.*mihomo-darwin-amd64-v.*gz" \
| cut -d '"' -f 4 \
| xargs curl -L -o clash.meta/mihomo-darwin-amd64.gz
echo "Download complete."
fi
echo "Unzip core files"
cd clash.meta
ls
gzip -d *.gz
echo "Create Universal core"
lipo -create -output com.metacubex.ClashX.ProxyConfigHelper.meta mihomo-darwin-amd64* mihomo-darwin-arm64*
chmod +x com.metacubex.ClashX.ProxyConfigHelper.meta
echo "Update meta core md5 to code"
CORE_MD5=$(md5 -q com.metacubex.ClashX.ProxyConfigHelper.meta)
echo "Core MD5: ${CORE_MD5}"
# 替换 MetaCoreMd5 常量的值,无论是占位符还是已有的 MD5
sed -i '' -E "s/(private let MetaCoreMd5 = \")[^\"]*(\")$/\1${CORE_MD5}\2/" ../ClashX/AppDelegate.swift
echo "Updated line:"
grep "MetaCoreMd5" ../ClashX/AppDelegate.swift
echo "Gzip Universal core"
gzip com.metacubex.ClashX.ProxyConfigHelper.meta
cp com.metacubex.ClashX.ProxyConfigHelper.meta.gz ../ClashX/Resources/
cd ..
echo "delete old files"
rm -f ./ClashX/Resources/country.mmdb
rm -f ./ClashX/Resources/geosite.dat
rm -f ./ClashX/Resources/geoip.dat
rm -rf ./ClashX/Resources/dashboard
rm -f GeoLite2-Country.*
echo "install mmdb"
curl -LO https://github.com/MetaCubeX/meta-rules-dat/raw/release/country.mmdb
gzip country.mmdb
mv country.mmdb.gz ./ClashX/Resources/country.mmdb.gz
echo "install geosite"
curl -LO https://github.com/MetaCubeX/meta-rules-dat/raw/release/geosite.dat
gzip geosite.dat
mv geosite.dat.gz ./ClashX/Resources/geosite.dat.gz
echo "install geoip"
curl -LO https://github.com/MetaCubeX/meta-rules-dat/raw/release/geoip.dat
gzip geoip.dat
mv geoip.dat.gz ./ClashX/Resources/geoip.dat.gz
echo "install yacd dashboard"
cd ClashX/Resources
git clone -b gh-pages https://github.com/MetaCubeX/Yacd-meta.git dashboard/yacd
cd dashboard/yacd
rm -rf *.webmanifest *.js CNAME .git
cd ../../
echo "install XD dashboard"
git clone -b gh-pages https://github.com/metacubex/metacubexd.git dashboard/xd
cd dashboard/xd
rm -rf *.webmanifest CNAME .git
cd ../../
echo "install zashboard"
git clone -b gh-pages https://github.com/Zephyruso/zashboard.git dashboard/zashboard
cd dashboard/zashboard
rm -rf *.webmanifest CNAME .git