-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpull-fonts.sh
executable file
·76 lines (61 loc) · 2 KB
/
pull-fonts.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
rootPath=$(pwd);
tmp="${rootPath}/tmp"
mkdir -p "${tmp}";
pullPingFang() {
pkgPath="${rootPath}/pingFang";
src="PingFang-for-Windows";
cd "${tmp}";
if [ -d "${src}" ]; then
cd "${src}";
git fetch -p;
git reset --hard FETCH_HEAD;
git pull;
else
git clone https://github.com/ACT-02/PingFang-for-Windows.git;
cd "${src}";
fi
# 遍历当前目录中的每个文件
fonts=$(find . -type f \( -name "*.ttf" -o -name "*.otf" -o -name "*.woff" -o -name "*.woff2" \));
for fontFile in $fonts; do
dir_name=$(echo "$fontFile" | awk -F '-' '{ print $1 }' | sed 's/PingFang\([A-Z]\)/pingFang\1/g')
buildPath="${pkgPath}/$dir_name";
# 判断目录是否存在,不存在则创建目录
if [ ! -d "$dir_name" ]; then
mkdir -p "${buildPath}"
fi
echo "Copy Font ${fontFile} ---> ${buildPath}"
cp "${fontFile}" "${buildPath}/"
done
echo "${src} finish ."
}
pullPingFangRelaxed() {
pkgPath="${rootPath}/pingFangRelaxed";
src="PingFang-Relaxed";
cd "${tmp}";
if [ -d "${src}" ]; then
cd "${src}";
git fetch -p;
git reset --hard FETCH_HEAD;
git pull;
else
git clone https://github.com/ACT-02/PingFang-Relaxed.git;
cd "${src}";
fi
# 遍历当前目录中的每个文件
fonts=$(find . -type f \( -name "*.ttf" -o -name "*.otf" -o -name "*.woff" -o -name "*.woff2" \));
for fontFile in $fonts; do
dir_name=$(echo "$fontFile" | awk -F '-' '{ print $1 }' | sed 's/PingFangRelaxed\([A-Z]\)/pingFangRelaxed\1/g')
buildPath="${pkgPath}/$dir_name";
# 判断目录是否存在,不存在则创建目录
if [ ! -d "$dir_name" ]; then
mkdir -p "${buildPath}"
fi
echo "Copy Font ${fontFile} ---> ${buildPath}"
cp "${fontFile}" "${buildPath}"
done
echo "${src} finish ."
}
pullPingFang;
pullPingFangRelaxed;
echo "Done ."