-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun.sh
50 lines (38 loc) · 1.3 KB
/
run.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
mkdir ./public/api -p
mkdir ./tmp/checker -p
mkdir ./tmp/parse -p
mkdir ./tmp/api/
chmod +x ./util/checker.sh
chmod +x ./util/parse.sh
chmod +x ./util/generator.sh
./util/checker.sh
./util/parse.sh stable-x86 stable-x64 beta-x86 beta-x64 dev-x86 dev-x64 canary-x86 canary-x64
cp -rf src/index.html tmp/index.html
cp -rf src/chrome.xml tmp/chrome.xml
DATE="$(echo $(TZ=UTC-8 date '+%Y-%m-%d %H:%M:%S'))"
sed -i "s|{{CheckTime}}|$DATE|g" tmp/index.html
sed -i "s|{{CheckTime}}|$DATE|g" tmp/chrome.xml
./util/generator.sh stable-x86 stable-x64 beta-x86 beta-x64 dev-x86 dev-x64 canary-x86 canary-x64
# Function to minify XML
minify_xml() {
local input=$1
local output=$2
# Remove newlines, leading/trailing whitespace, and consolidate spaces
tr -d '\n' < "$input" | \
sed -E '
# Remove spaces between tags
s/>[[:space:]]+</></g
# Remove leading/trailing whitespace
s/^[[:space:]]+//
s/[[:space:]]+$//
# Consolidate multiple spaces into one
s/[[:space:]]+/ /g
' > "$output"
}
# Format XML
cp "tmp/chrome.xml" "tmp/api/chrome.xml"
# Minify XML
minify_xml "tmp/chrome.xml" "tmp/api/chrome.min.xml"
cp -rf tmp/index.html public/index.html
cp -rf tmp/api/chrome.xml public/api/chrome.xml
cp -rf tmp/api/chrome.min.xml public/api/chrome.min.xml