From c028a4a997d3d8a3d4642ef91f217bd61bc662a9 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Sun, 19 Aug 2018 22:41:07 +0800 Subject: [PATCH 1/9] refactor: simplify the parse --- .travis.yml | 2 +- run.sh | 9 ++++ checker.sh => util/checker.sh | 88 +++++++++++++++++-------------- util/parse.sh | 24 +++++++++ xmlparser.sh => util/xmlparser.sh | 0 5 files changed, 81 insertions(+), 42 deletions(-) create mode 100644 run.sh rename checker.sh => util/checker.sh (75%) create mode 100644 util/parse.sh rename xmlparser.sh => util/xmlparser.sh (100%) diff --git a/.travis.yml b/.travis.yml index 2ab6d04..1d18ccf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ install: script: - chmod +x ./checker.sh - chmod +x ./combine.sh - - chmod +x ./xmlparser.sh + - chmod +x ./util/xmlparser.sh - chmod +x ./build.sh - chmod +x ./deploy.sh - ./checker.sh diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..86460e3 --- /dev/null +++ b/run.sh @@ -0,0 +1,9 @@ +mkdir ./public -p +mkdir ./tmp/checker -p +mkdir ./tmp/parse -p + +chmod +x ./util/checker.sh +chmod +x ./util/xmlparser.sh +chmod +x ./util/parse.sh + +./util/parse.sh stable-x86 stable-x64 beta-x86 beta-x64 dev-x86 dev-x64 canary-x86 canary-x64 \ No newline at end of file diff --git a/checker.sh b/util/checker.sh similarity index 75% rename from checker.sh rename to util/checker.sh index 8401483..cd6b9d2 100644 --- a/checker.sh +++ b/util/checker.sh @@ -1,11 +1,10 @@ -mkdir ./public -mkdir ./tmp - echo '-------------------------------------' +echo 'Start Checking Chrome ......' +echo '-------------------------------------' + echo 'Checking Chrome Stable x86 ......' -echo '-------------------------------------' -curl "https://tools.google.com/service/update2" --data " +curl -s "https://tools.google.com/service/update2" --data " @@ -14,14 +13,15 @@ curl "https://tools.google.com/service/update2" --data " - " > ./tmp/stable-x86.unformat.xml + " > ./tmp/checker/stable-x86.xml echo '' -echo '-------------------------------------' -echo 'Checking Chrome Stable x64 ......' -echo '-------------------------------------' -curl "https://tools.google.com/service/update2" --data " +sleep 1 + +echo 'Checking Chrome Stable x64 ......' + +curl -s "https://tools.google.com/service/update2" --data " @@ -30,14 +30,15 @@ curl "https://tools.google.com/service/update2" --data " - " > ./tmp/stable-x64.unformat.xml + " > ./tmp/checker/stable-x64.xml echo '' -echo '-------------------------------------' -echo 'Checking Chrome Beta x86 ......' -echo '-------------------------------------' -curl "https://tools.google.com/service/update2" --data " +sleep 1 + +echo 'Checking Chrome Beta x86 ......' + +curl -s "https://tools.google.com/service/update2" --data " @@ -46,14 +47,15 @@ curl "https://tools.google.com/service/update2" --data " - " > ./tmp/beta-x86.unformat.xml + " > ./tmp/checker/beta-x86.xml echo '' -echo '-------------------------------------' -echo 'Checking Chrome Beta x64 ......' -echo '-------------------------------------' -curl "https://tools.google.com/service/update2" --data " +sleep 1 + +echo 'Checking Chrome Beta x64 ......' + +curl -s "https://tools.google.com/service/update2" --data " @@ -62,14 +64,15 @@ curl "https://tools.google.com/service/update2" --data " - " > ./tmp/beta-x64.unformat.xml + " > ./tmp/checker/beta-x64.xml echo '' -echo '-------------------------------------' -echo 'Checking Chrome Dev x86 ......' -echo '-------------------------------------' -curl "https://tools.google.com/service/update2" --data " +sleep 1 + +echo 'Checking Chrome Dev x86 ......' + +curl -s "https://tools.google.com/service/update2" --data " @@ -78,14 +81,15 @@ curl "https://tools.google.com/service/update2" --data " - " > ./tmp/dev-x86.unformat.xml + " > ./tmp/checker/dev-x86.xml echo '' -echo '-------------------------------------' -echo 'Checking Chrome Dev x64 ......' -echo '-------------------------------------' -curl "https://tools.google.com/service/update2" --data " +sleep 1 + +echo 'Checking Chrome Dev x64 ......' + +curl -s "https://tools.google.com/service/update2" --data " @@ -94,14 +98,15 @@ curl "https://tools.google.com/service/update2" --data " - " > ./tmp/dev-x64.unformat.xml + " > ./tmp/checker/dev-x64.xml echo '' -echo '-------------------------------------' -echo 'Checking Chrome Canary x86 ......' -echo '-------------------------------------' -curl "https://tools.google.com/service/update2" --data " +sleep 1 + +echo 'Checking Chrome Canary x86 ......' + +curl -s "https://tools.google.com/service/update2" --data " @@ -110,14 +115,15 @@ curl "https://tools.google.com/service/update2" --data " - " > ./tmp/canary-x86.unformat.xml + " > ./tmp/checker/canary-x86.xml echo '' -echo '-------------------------------------' -echo 'Checking Chrome Canary x64 ......' -echo '-------------------------------------' -curl "https://tools.google.com/service/update2" --data " +sleep 1 + +echo 'Checking Chrome Canary x64 ......' + +curl -s "https://tools.google.com/service/update2" --data " @@ -126,4 +132,4 @@ curl "https://tools.google.com/service/update2" --data " - " > ./tmp/canary-x64.unformat.xml \ No newline at end of file + " > ./tmp/checker/canary-x64.xml diff --git a/util/parse.sh b/util/parse.sh new file mode 100644 index 0000000..3fceeeb --- /dev/null +++ b/util/parse.sh @@ -0,0 +1,24 @@ +for i in $@ +do + echo 'Parsing '${i}' data ......' + + xmllint --format ./tmp/checker/${i}.xml > ./tmp/checker/${i}.format.xml + ./util/xmlparser.sh ./tmp/checker/${i}.format.xml > ./tmp/parse/${i}.info + + sed -i 's| ELEMENT=manifest ATTRIBUTE=version VALUE=||g' ./tmp/parse/${i}.info + sed -i 's| ELEMENT=url ATTRIBUTE=codebase VALUE=||g' ./tmp/parse/${i}.info + sed -i 's| ATTRIBUTE=hash |\n|g' ./tmp/parse/${i}.info + sed -i 's| ATTRIBUTE=name VALUE=|\n|g' ./tmp/parse/${i}.info + sed -i 's| ATTRIBUTE=required VALUE=true ATTRIBUTE=size VALUE=|\n|g' ./tmp/parse/${i}.info + sed -i 's| ATTRIBUTE=hash_sha256 VALUE=|\n|g' ./tmp/parse/${i}.info + sed -i 's| ELEMENT=time ATTRIBUTE=checktime VALUE=||g' ./tmp/parse/${i}.info + sed -i 's|https://||g' ./tmp/parse/${i}.info + sed -i 's| ||g' ./tmp/parse/${i}.info + + sed -n '8p' ./tmp/parse/${i}.info > ./tmp/parse/${i}-result.info + sed -n '10p' ./tmp/parse/${i}.info >> ./tmp/parse/${i}-result.info + sed -n '14p' ./tmp/parse/${i}.info >> ./tmp/parse/${i}-result.info + sed -n '23p' ./tmp/parse/${i}.info >> ./tmp/parse/${i}-result.info + sed -n '22p' ./tmp/parse/${i}.info >> ./tmp/parse/${i}-result.info + sed -n '24p' ./tmp/parse/${i}.info >> ./tmp/parse/${i}-result.info +done diff --git a/xmlparser.sh b/util/xmlparser.sh similarity index 100% rename from xmlparser.sh rename to util/xmlparser.sh From 3c6538c7584fad7ac27271f7de48822c328e6ad7 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Mon, 20 Aug 2018 09:48:05 +0800 Subject: [PATCH 2/9] refactor: some minor changes --- run.sh | 4 +++- util/parse.sh | 4 ++-- util/xmlparser.sh | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/run.sh b/run.sh index 86460e3..c74f6e8 100644 --- a/run.sh +++ b/run.sh @@ -6,4 +6,6 @@ chmod +x ./util/checker.sh chmod +x ./util/xmlparser.sh chmod +x ./util/parse.sh -./util/parse.sh stable-x86 stable-x64 beta-x86 beta-x64 dev-x86 dev-x64 canary-x86 canary-x64 \ No newline at end of file +./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 diff --git a/util/parse.sh b/util/parse.sh index 3fceeeb..7203ba2 100644 --- a/util/parse.sh +++ b/util/parse.sh @@ -15,9 +15,9 @@ do sed -i 's|https://||g' ./tmp/parse/${i}.info sed -i 's| ||g' ./tmp/parse/${i}.info - sed -n '8p' ./tmp/parse/${i}.info > ./tmp/parse/${i}-result.info + sed -n '14p' ./tmp/parse/${i}.info > ./tmp/parse/${i}-result.info + sed -n '8p' ./tmp/parse/${i}.info >> ./tmp/parse/${i}-result.info sed -n '10p' ./tmp/parse/${i}.info >> ./tmp/parse/${i}-result.info - sed -n '14p' ./tmp/parse/${i}.info >> ./tmp/parse/${i}-result.info sed -n '23p' ./tmp/parse/${i}.info >> ./tmp/parse/${i}-result.info sed -n '22p' ./tmp/parse/${i}.info >> ./tmp/parse/${i}-result.info sed -n '24p' ./tmp/parse/${i}.info >> ./tmp/parse/${i}-result.info diff --git a/util/xmlparser.sh b/util/xmlparser.sh index 47abc76..92a2b80 100644 --- a/util/xmlparser.sh +++ b/util/xmlparser.sh @@ -124,5 +124,5 @@ read_xml() { : done < "$1" } - + read_xml "$1" From 356c37144a1cd9edc2c6509729b3f3af46702b88 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Mon, 20 Aug 2018 09:50:40 +0800 Subject: [PATCH 3/9] refactor: html template --- src/index.html | 197 ++++++++++++------------------------------------- 1 file changed, 49 insertions(+), 148 deletions(-) diff --git a/src/index.html b/src/index.html index 7163fe0..3b6bf8c 100644 --- a/src/index.html +++ b/src/index.html @@ -12,106 +12,7 @@ - + @@ -163,48 +64,48 @@

Stable 稳定版 32 位   - {{Stable32-Version}} + {{stable-x86-Version}}


文件大小   - {{Stable32-Size}} + {{stable-x86-Size}}

SHA256 -

{{Stable32-SHA256}}
+
{{stable-x86-SHA256}}

Stable 稳定版 64 位   - {{Stable64-Version}} + {{stable-x64-Version}}


文件大小   - {{Stable64-Size}} + {{stable-x64-Size}}

SHA256 -

{{Stable64-SHA256}}
+
{{stable-x64-SHA256}}

@@ -213,48 +114,48 @@

Beta 测试版 32 位   - {{Beta32-Version}} + {{beta-x86-Version}}


文件大小   - {{Beta32-Size}} + {{beta-x86-Size}}

SHA256 -

{{Beta32-SHA256}}
+
{{beta-x86-SHA256}}

Beta 测试版 64 位   - {{Beta64-Version}} + {{beta-x64-Version}}


文件大小   - {{Beta64-Size}} + {{beta-x64-Size}}

SHA256 -

{{Beta64-SHA256}}
+
{{beta-x64-SHA256}}

@@ -263,48 +164,48 @@

Dev 开发版 32 位   - {{Dev32-Version}} + {{dev-x86-Version}}


文件大小   - {{Dev32-Size}} + {{dev-x86-Size}}

SHA256 -

{{Dev32-SHA256}}
+
{{dev-x86-SHA256}}

Dev 开发版 64 位   - {{Dev64-Version}} + {{dev-x64-Version}}


文件大小   - {{Dev64-Size}} + {{dev-x64-Size}}

SHA256 -

{{Dev64-SHA256}}
+
{{dev-x64-SHA256}}

@@ -313,48 +214,48 @@

Canary 金丝雀 32 位   - {{Canary32-Version}} + {{canary-x86-Version}}


文件大小   - {{Canary32-Size}} + {{canary-x86-Size}}

SHA256 -

{{Canary32-SHA256}}
+
{{canary-x86-SHA256}}

Canary 金丝雀 64 位   - {{Canary64-Version}} + {{canary-x64-Version}}


文件大小   - {{Canary64-Size}} + {{canary-x64-Size}}

SHA256 -

{{Canary64-SHA256}}
+
{{canary-x64-SHA256}}

From 933bfdaa6bdf98564171ed47ab2fc5d3c6e8b65f Mon Sep 17 00:00:00 2001 From: SukkaW Date: Mon, 20 Aug 2018 10:10:54 +0800 Subject: [PATCH 4/9] feat: bring up api xml template --- src/chrome.xml | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 src/chrome.xml diff --git a/src/chrome.xml b/src/chrome.xml new file mode 100644 index 0000000..d0d27ec --- /dev/null +++ b/src/chrome.xml @@ -0,0 +1,77 @@ + + + + + + {{stable-x86-Version}} + + {{stable-x86-dl-main}} + {{stable-x86-dl-alternative}} + + {{stable-x86-SHA256}} + {{stable-x86-Size}} + + + {{stable-x64-Version}} + + {{stable-x64-dl-main}} + {{stable-x64-dl-alternative}} + + {{stable-x64-SHA256}} + {{stable-x64-Size}} + + + {{beta-x86-Version}} + + {{beta-x86-dl-main}} + {{beta-x86-dl-alternative}} + + {{beta-x86-SHA256}} + {{beta-x86-Size}} + + + {{beta-x64-Version}} + + {{beta-x64-dl-main}} + {{beta-x64-dl-alternative}} + + {{beta-x64-SHA256}} + {{beta-x64-Size}} + + + {{dev-x86-Version}} + + {{dev-x86-dl-main}} + {{dev-x86-dl-alternative}} + + {{dev-x86-SHA256}} + {{dev-x86-Size}} + + + {{dev-x64-Version}} + + {{dev-x64-dl-main}} + {{dev-x64-dl-alternative}} + + {{dev-x64-SHA256}} + {{dev-x64-Size}} + + + {{canary-x86-Version}} + + {{canary-x86-dl-main}} + {{canary-x86-dl-alternative}} + + {{canary-x86-SHA256}} + {{canary-x86-Size}} + + + {{canary-x64-Version}} + + {{canary-x64-dl-main}} + {{canary-x64-dl-alternative}} + + {{canary-x64-SHA256}} + {{canary-x64-Size}} + + From c9b66c9394d37bad09b05d634d8bd1b4bec63982 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Mon, 20 Aug 2018 10:24:29 +0800 Subject: [PATCH 5/9] refactor/fix: some minor changes --- run.sh | 21 ++++++++++++++++++++- src/chrome.xml | 1 - util/checker.sh | 14 -------------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/run.sh b/run.sh index c74f6e8..d05266d 100644 --- a/run.sh +++ b/run.sh @@ -1,11 +1,30 @@ -mkdir ./public -p +mkdir ./public/api -p mkdir ./tmp/checker -p mkdir ./tmp/parse -p +mkdir ./tmp/api/ chmod +x ./util/checker.sh chmod +x ./util/xmlparser.sh chmod +x ./util/parse.sh +chmod +x ./util/generator.sh +chmod +x ./util/deployer.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.tpl 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 + +xmllint --format tmp/chrome.xml > tmp/api/chrome.xml +xmllint --noblanks 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 diff --git a/src/chrome.xml b/src/chrome.xml index d0d27ec..1648bbd 100644 --- a/src/chrome.xml +++ b/src/chrome.xml @@ -1,4 +1,3 @@ - diff --git a/util/checker.sh b/util/checker.sh index cd6b9d2..cc31d3c 100644 --- a/util/checker.sh +++ b/util/checker.sh @@ -15,8 +15,6 @@ curl -s "https://tools.google.com/service/update2" --data " " > ./tmp/checker/stable-x86.xml -echo '' - sleep 1 echo 'Checking Chrome Stable x64 ......' @@ -32,8 +30,6 @@ curl -s "https://tools.google.com/service/update2" --data " " > ./tmp/checker/stable-x64.xml -echo '' - sleep 1 echo 'Checking Chrome Beta x86 ......' @@ -49,8 +45,6 @@ curl -s "https://tools.google.com/service/update2" --data " " > ./tmp/checker/beta-x86.xml -echo '' - sleep 1 echo 'Checking Chrome Beta x64 ......' @@ -66,8 +60,6 @@ curl -s "https://tools.google.com/service/update2" --data " " > ./tmp/checker/beta-x64.xml -echo '' - sleep 1 echo 'Checking Chrome Dev x86 ......' @@ -83,8 +75,6 @@ curl -s "https://tools.google.com/service/update2" --data " " > ./tmp/checker/dev-x86.xml -echo '' - sleep 1 echo 'Checking Chrome Dev x64 ......' @@ -100,8 +90,6 @@ curl -s "https://tools.google.com/service/update2" --data " " > ./tmp/checker/dev-x64.xml -echo '' - sleep 1 echo 'Checking Chrome Canary x86 ......' @@ -117,8 +105,6 @@ curl -s "https://tools.google.com/service/update2" --data " " > ./tmp/checker/canary-x86.xml -echo '' - sleep 1 echo 'Checking Chrome Canary x64 ......' From dabf13058a129d341912aa72902e6e9a283661ac Mon Sep 17 00:00:00 2001 From: SukkaW Date: Mon, 20 Aug 2018 10:24:46 +0800 Subject: [PATCH 6/9] feat: bring up generator & deployer --- deploy.sh => util/deployer.sh | 0 util/generator.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) rename deploy.sh => util/deployer.sh (100%) create mode 100644 util/generator.sh diff --git a/deploy.sh b/util/deployer.sh similarity index 100% rename from deploy.sh rename to util/deployer.sh diff --git a/util/generator.sh b/util/generator.sh new file mode 100644 index 0000000..74e0eeb --- /dev/null +++ b/util/generator.sh @@ -0,0 +1,33 @@ +echo '' +echo '-------------------------------------' +echo 'Start Generator ......' +echo '-------------------------------------' + +for i in $@ +do + cache="http://101.96.10.72/" + version=$(sed -n '1p' ./tmp/parse/${i}-result.info) + dl_base=$(sed -n '2p' ./tmp/parse/${i}-result.info) + dl_alt_base=$(sed -n '3p' ./tmp/parse/${i}-result.info) + dl_file=$(sed -n '4p' ./tmp/parse/${i}-result.info) + dl="https://"${dl_base}${dl_file} + dl_alt="https://"${dl_alt_base}${dl_file} + dl_cache=${cache}${dl_alt_base}${dl_file} + sha256=$(sed -n '5p' ./tmp/parse/${i}-result.info) + size_raw=$(sed -n '6p' ./tmp/parse/${i}-result.info) + size=$(awk 'BEGIN{printf "%.3f",('$size_raw'/'1048576')}')" MB" + + sed -i "s|{{${i}-Version}}|$version|g" tmp/index.html + sed -i "s|{{${i}-SHA256}}|$sha256|g" tmp/index.html + sed -i "s|{{${i}-dl-main}}|$dl|g" tmp/index.html + sed -i "s|{{${i}-dl-alternative}}|$dl_alt|g" tmp/index.html + sed -i "s|{{${i}-dl-cache}}|$dl_cache|g" tmp/index.html + sed -i "s|{{${i}-Size}}|$size|g" tmp/index.html + + sed -i "s|{{${i}-Version}}|$version|g" tmp/chrome.xml + sed -i "s|{{${i}-SHA256}}|$sha256|g" tmp/chrome.xml + sed -i "s|{{${i}-dl-main}}|$dl|g" tmp/chrome.xml + sed -i "s|{{${i}-dl-alternative}}|$dl_alt|g" tmp/chrome.xml + sed -i "s|{{${i}-dl-cache}}|$dl_cache|g" tmp/chrome.xml + sed -i "s|{{${i}-Size}}|$size|g" tmp/chrome.xml +done \ No newline at end of file From 1b4ca9b2937a272eb17ef944eceecbf17537f8ed Mon Sep 17 00:00:00 2001 From: SukkaW Date: Mon, 20 Aug 2018 10:25:01 +0800 Subject: [PATCH 7/9] remove useless build.sh & combine.sh --- build.sh | 289 ----------------------------------------------------- combine.sh | 99 ------------------ 2 files changed, 388 deletions(-) delete mode 100644 build.sh delete mode 100644 combine.sh diff --git a/build.sh b/build.sh deleted file mode 100644 index 64e11ce..0000000 --- a/build.sh +++ /dev/null @@ -1,289 +0,0 @@ -echo '' -echo '-------------------------------------' -echo 'Building HTML ......' -echo '-------------------------------------' - -sed -i 's| ELEMENT=manifest ATTRIBUTE=version VALUE=||g' tmp/chrome_xml_parser_result.txt -sed -i 's| ELEMENT=url ATTRIBUTE=codebase VALUE=||g' tmp/chrome_xml_parser_result.txt -sed -i 's| ATTRIBUTE=hash |\n|g' tmp/chrome_xml_parser_result.txt -sed -i 's| ATTRIBUTE=name VALUE=|\n|g' tmp/chrome_xml_parser_result.txt -sed -i 's| ATTRIBUTE=required VALUE=true ATTRIBUTE=size VALUE=|\n|g' tmp/chrome_xml_parser_result.txt -sed -i 's| ATTRIBUTE=hash_sha256 VALUE=|\n|g' tmp/chrome_xml_parser_result.txt -sed -i 's| ELEMENT=time ATTRIBUTE=checktime VALUE=||g' tmp/chrome_xml_parser_result.txt -sed -i 's|https://||g' tmp/chrome_xml_parser_result.txt -sed -i 's| ||g' tmp/chrome_xml_parser_result.txt - -checktime=$(sed -n '3p' ./tmp/chrome_xml_parser_result.txt) - -cache="http://101.96.10.72/" - -stable32_version=$(sed -n '5p' ./tmp/chrome_xml_parser_result.txt) -stable32_dl_base=$(sed -n '6p' ./tmp/chrome_xml_parser_result.txt) -stable32_dl_alt_base=$(sed -n '7p' ./tmp/chrome_xml_parser_result.txt) -stable32_sha256=$(sed -n '10p' ./tmp/chrome_xml_parser_result.txt) -stable32_file=$(sed -n '11p' ./tmp/chrome_xml_parser_result.txt) -stable32_size_raw=$(sed -n '12p' ./tmp/chrome_xml_parser_result.txt) -stable32_dl="https://"${stable32_dl_base}${stable32_file} -stable32_dl_alt="https://"${stable32_dl_alt_base}${stable32_file} -stable32_dl_cache=${cache}${stable32_dl_base}${stable32_file} -stable32_size=$(awk 'BEGIN{printf "%.3f",('$stable32_size_raw'/'1048576')}')" MB" - -stable64_version=$(sed -n '15p' ./tmp/chrome_xml_parser_result.txt) -stable64_dl_base=$(sed -n '16p' ./tmp/chrome_xml_parser_result.txt) -stable64_dl_alt_base=$(sed -n '17p' ./tmp/chrome_xml_parser_result.txt) -stable64_sha256=$(sed -n '20p' ./tmp/chrome_xml_parser_result.txt) -stable64_file=$(sed -n '21p' ./tmp/chrome_xml_parser_result.txt) -stable64_size_raw=$(sed -n '22p' ./tmp/chrome_xml_parser_result.txt) -stable64_dl="https://"${stable64_dl_base}${stable64_file} -stable64_dl_alt="https://"${stable64_dl_alt_base}${stable64_file} -stable64_dl_cache=${cache}${stable64_dl_base}${stable64_file} -stable64_size=$(awk 'BEGIN{printf "%.3f",('$stable64_size_raw'/'1048576')}')" MB" - -beta32_version=$(sed -n '25p' ./tmp/chrome_xml_parser_result.txt) -beta32_dl_base=$(sed -n '26p' ./tmp/chrome_xml_parser_result.txt) -beta32_dl_alt_base=$(sed -n '27p' ./tmp/chrome_xml_parser_result.txt) -beta32_sha256=$(sed -n '30p' ./tmp/chrome_xml_parser_result.txt) -beta32_file=$(sed -n '31p' ./tmp/chrome_xml_parser_result.txt) -beta32_size_raw=$(sed -n '32p' ./tmp/chrome_xml_parser_result.txt) -beta32_dl="https://"${beta32_dl_base}${beta32_file} -beta32_dl_alt="https://"${beta32_dl_alt_base}${beta32_file} -beta32_dl_cache=${cache}${beta32_dl_base}${beta32_file} -beta32_size=$(awk 'BEGIN{printf "%.3f",('$beta32_size_raw'/'1048576')}')" MB" - -beta64_version=$(sed -n '35p' ./tmp/chrome_xml_parser_result.txt) -beta64_dl_base=$(sed -n '36p' ./tmp/chrome_xml_parser_result.txt) -beta64_dl_alt_base=$(sed -n '37p' ./tmp/chrome_xml_parser_result.txt) -beta64_sha256=$(sed -n '40p' ./tmp/chrome_xml_parser_result.txt) -beta64_file=$(sed -n '41p' ./tmp/chrome_xml_parser_result.txt) -beta64_size_raw=$(sed -n '42p' ./tmp/chrome_xml_parser_result.txt) -beta64_dl="https://"${beta64_dl_base}${beta64_file} -beta64_dl_alt="https://"${beta64_dl_alt_base}${beta64_file} -beta64_dl_cache=${cache}${beta64_dl_base}${beta64_file} -beta64_size=$(awk 'BEGIN{printf "%.3f",('$beta64_size_raw'/'1048576')}')" MB" - -dev32_version=$(sed -n '45p' ./tmp/chrome_xml_parser_result.txt) -dev32_dl_base=$(sed -n '46p' ./tmp/chrome_xml_parser_result.txt) -dev32_dl_alt_base=$(sed -n '47p' ./tmp/chrome_xml_parser_result.txt) -dev32_sha256=$(sed -n '50p' ./tmp/chrome_xml_parser_result.txt) -dev32_file=$(sed -n '21p' ./tmp/chrome_xml_parser_result.txt) -dev32_size_raw=$(sed -n '22p' ./tmp/chrome_xml_parser_result.txt) -dev32_dl="https://"${dev32_dl_base}${dev32_file} -dev32_dl_alt="https://"${dev32_dl_alt_base}${dev32_file} -dev32_dl_cache=${cache}${dev32_dl_base}${dev32_file} -dev32_size=$(awk 'BEGIN{printf "%.3f",('$dev32_size_raw'/'1048576')}')" MB" - -dev64_version=$(sed -n '55p' ./tmp/chrome_xml_parser_result.txt) -dev64_dl_base=$(sed -n '56p' ./tmp/chrome_xml_parser_result.txt) -dev64_dl_alt_base=$(sed -n '57p' ./tmp/chrome_xml_parser_result.txt) -dev64_sha256=$(sed -n '60p' ./tmp/chrome_xml_parser_result.txt) -dev64_file=$(sed -n '61p' ./tmp/chrome_xml_parser_result.txt) -dev64_size_raw=$(sed -n '62p' ./tmp/chrome_xml_parser_result.txt) -dev64_dl="https://"${dev64_dl_base}${dev64_file} -dev64_dl_alt="https://"${dev64_dl_alt_base}${dev64_file} -dev64_dl_cache=${cache}${dev64_dl_base}${dev64_file} -dev64_size=$(awk 'BEGIN{printf "%.3f",('$dev64_size_raw'/'1048576')}')" MB" - -canary32_version=$(sed -n '65p' ./tmp/chrome_xml_parser_result.txt) -canary32_dl_base=$(sed -n '66p' ./tmp/chrome_xml_parser_result.txt) -canary32_dl_alt_base=$(sed -n '67p' ./tmp/chrome_xml_parser_result.txt) -canary32_sha256=$(sed -n '70p' ./tmp/chrome_xml_parser_result.txt) -canary32_file=$(sed -n '71p' ./tmp/chrome_xml_parser_result.txt) -canary32_size_raw=$(sed -n '72p' ./tmp/chrome_xml_parser_result.txt) -canary32_dl="https://"${canary32_dl_base}${canary32_file} -canary32_dl_alt="https://"${canary32_dl_alt_base}${canary32_file} -canary32_dl_cache=${cache}${canary32_dl_base}${canary32_file} -canary32_size=$(awk 'BEGIN{printf "%.3f",('$canary32_size_raw'/'1048576')}')" MB" - -canary64_version=$(sed -n '75p' ./tmp/chrome_xml_parser_result.txt) -canary64_dl_base=$(sed -n '76p' ./tmp/chrome_xml_parser_result.txt) -canary64_dl_alt_base=$(sed -n '77p' ./tmp/chrome_xml_parser_result.txt) -canary64_sha256=$(sed -n '80p' ./tmp/chrome_xml_parser_result.txt) -canary64_file=$(sed -n '81p' ./tmp/chrome_xml_parser_result.txt) -canary64_size_raw=$(sed -n '82p' ./tmp/chrome_xml_parser_result.txt) -canary64_dl="https://"${canary64_dl_base}${canary64_file} -canary64_dl_alt="https://"${canary64_dl_alt_base}${canary64_file} -canary64_dl_cache=${cache}${canary64_dl_base}${canary64_file} -canary64_size=$(awk 'BEGIN{printf "%.3f",('$canary64_size_raw'/'1048576')}')" MB" - -cp -rf src/index.html tmp/index.html - -sed -i "s/{{CheckTime}}/$checktime/g" tmp/index.html - -sed -i "s|{{Stable32-Version}}|$stable32_version|g" tmp/index.html -sed -i "s|{{Stable32-SHA256}}|$stable32_sha256|g" tmp/index.html -sed -i "s|{{Stable32-dl-main}}|$stable32_dl|g" tmp/index.html -sed -i "s|{{Stable32-dl-alternative}}|$stable32_dl_alt|g" tmp/index.html -sed -i "s|{{Stable32-dl-cache}}|$stable32_dl_cache|g" tmp/index.html -sed -i "s|{{Stable32-Size}}|$stable32_size|g" tmp/index.html - -sed -i "s|{{Stable64-Version}}|$stable64_version|g" tmp/index.html -sed -i "s|{{Stable64-SHA256}}|$stable64_sha256|g" tmp/index.html -sed -i "s|{{Stable64-dl-main}}|$stable64_dl|g" tmp/index.html -sed -i "s|{{Stable64-dl-alternative}}|$stable64_dl_alt|g" tmp/index.html -sed -i "s|{{Stable64-dl-cache}}|$stable64_dl_cache|g" tmp/index.html -sed -i "s|{{Stable64-Size}}|$stable64_size|g" tmp/index.html - -sed -i "s|{{Beta32-Version}}|$beta32_version|g" tmp/index.html -sed -i "s|{{Beta32-SHA256}}|$beta32_sha256|g" tmp/index.html -sed -i "s|{{Beta32-dl-main}}|$beta32_dl|g" tmp/index.html -sed -i "s|{{Beta32-dl-alternative}}|$beta32_dl_alt|g" tmp/index.html -sed -i "s|{{Beta32-dl-cache}}|$beta32_dl_cache|g" tmp/index.html -sed -i "s|{{Beta32-Size}}|$beta32_size|g" tmp/index.html - -sed -i "s|{{Beta64-Version}}|$beta64_version|g" tmp/index.html -sed -i "s|{{Beta64-SHA256}}|$beta64_sha256|g" tmp/index.html -sed -i "s|{{Beta64-dl-main}}|$beta64_dl|g" tmp/index.html -sed -i "s|{{Beta64-dl-alternative}}|$beta64_dl_alt|g" tmp/index.html -sed -i "s|{{Beta64-dl-cache}}|$beta64_dl_cache|g" tmp/index.html -sed -i "s|{{Beta64-Size}}|$beta64_size|g" tmp/index.html - -sed -i "s|{{Dev32-Version}}|$dev32_version|g" tmp/index.html -sed -i "s|{{Dev32-SHA256}}|$dev32_sha256|g" tmp/index.html -sed -i "s|{{Dev32-dl-main}}|$dev32_dl|g" tmp/index.html -sed -i "s|{{Dev32-dl-alternative}}|$dev32_dl_alt|g" tmp/index.html -sed -i "s|{{Dev32-dl-cache}}|$dev32_dl_cache|g" tmp/index.html -sed -i "s|{{Dev32-Size}}|$dev32_size|g" tmp/index.html - -sed -i "s|{{Dev64-Version}}|$dev64_version|g" tmp/index.html -sed -i "s|{{Dev64-SHA256}}|$dev64_sha256|g" tmp/index.html -sed -i "s|{{Dev64-dl-main}}|$dev64_dl|g" tmp/index.html -sed -i "s|{{Dev64-dl-alternative}}|$dev64_dl_alt|g" tmp/index.html -sed -i "s|{{Dev64-dl-cache}}|$dev64_dl_cache|g" tmp/index.html -sed -i "s|{{Dev64-Size}}|$dev64_size|g" tmp/index.html - -sed -i "s|{{Canary32-Version}}|$canary32_version|g" tmp/index.html -sed -i "s|{{Canary32-SHA256}}|$canary32_sha256|g" tmp/index.html -sed -i "s|{{Canary32-dl-main}}|$canary32_dl|g" tmp/index.html -sed -i "s|{{Canary32-dl-alternative}}|$canary32_dl_alt|g" tmp/index.html -sed -i "s|{{Canary32-dl-cache}}|$canary32_dl_cache|g" tmp/index.html -sed -i "s|{{Canary32-Size}}|$canary32_size|g" tmp/index.html - -sed -i "s|{{Canary64-Version}}|$canary64_version|g" tmp/index.html -sed -i "s|{{Canary64-SHA256}}|$canary64_sha256|g" tmp/index.html -sed -i "s|{{Canary64-dl-main}}|$canary64_dl|g" tmp/index.html -sed -i "s|{{Canary64-dl-alternative}}|$canary64_dl_alt|g" tmp/index.html -sed -i "s|{{Canary64-dl-cache}}|$canary64_dl_cache|g" tmp/index.html -sed -i "s|{{Canary64-Size}}|$canary64_size|g" tmp/index.html - -cp -rf tmp/index.html public/index.html - -mkdir ./tmp/api/ - -echo '' -echo '-------------------------------------' -echo 'Generate Static API ......' -echo '-------------------------------------' - -echo '' > tmp/api/chrome.xml -echo '' >> tmp/api/chrome.tmp.xml -DATE="$(echo $(TZ=UTC-8 date '+%Y-%m-%d %H:%M:%S'))" -echo '' >> tmp/api/chrome.tmp.xml - -echo '' -echo '-------------------------------------' -echo 'Formatting API Output ......' -echo '-------------------------------------' - -xmllint --format tmp/api/chrome.tmp.xml > tmp/api/chrome.xml - -echo '' -echo '-------------------------------------' -echo 'Compressing API Output ......' -echo '-------------------------------------' - -xmllint --noblanks tmp/api/chrome.tmp.xml > tmp/api/chrome.min.xml - -mkdir public/api/ -p - -cp -rf tmp/api/chrome.xml public/api/chrome.xml -cp -rf tmp/api/chrome.min.xml public/api/chrome.min.xml \ No newline at end of file diff --git a/combine.sh b/combine.sh deleted file mode 100644 index 7338c6d..0000000 --- a/combine.sh +++ /dev/null @@ -1,99 +0,0 @@ -echo '' -echo '-------------------------------------' -echo 'Formatting XML Files ......' -echo '-------------------------------------' - -cd ./tmp -xmllint --format stable-x86.unformat.xml > stable-x86.format.xml -xmllint --format stable-x64.unformat.xml > stable-x64.format.xml -xmllint --format beta-x86.unformat.xml > beta-x86.format.xml -xmllint --format beta-x64.unformat.xml > beta-x64.format.xml -xmllint --format dev-x86.unformat.xml > dev-x86.format.xml -xmllint --format dev-x64.unformat.xml > dev-x64.format.xml -xmllint --format canary-x86.unformat.xml > canary-x86.format.xml -xmllint --format canary-x64.unformat.xml > canary-x64.format.xml - -echo '' -echo '-------------------------------------' -echo 'Combining XML Files ......' -echo '-------------------------------------' - -echo '' > chrome.tmp.xml - -echo '' >> chrome.tmp.xml - -DATE="$(echo $(TZ=UTC-8 date '+%Y-%m-%d_%H:%M:%S'))" -echo '' >> chrome.tmp.xml - -echo '' -echo '-------------------------------------' -echo 'Formatting Output ......' -echo '-------------------------------------' - -sed -i 's|">|"/>|g' chrome.tmp.xml -xmllint --format chrome.tmp.xml > chrome.xml - -cd .. - -echo '' -echo '-------------------------------------' -echo 'Parsing XML Files ......' -echo '-------------------------------------' \ No newline at end of file From 53179cde57f6721dbc7db10e1e786ca96d2dfeb3 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Mon, 20 Aug 2018 10:28:27 +0800 Subject: [PATCH 8/9] refactor/feat: add log output --- util/deployer.sh | 5 +++++ util/parse.sh | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/util/deployer.sh b/util/deployer.sh index da5e8c5..a6133da 100644 --- a/util/deployer.sh +++ b/util/deployer.sh @@ -1,3 +1,8 @@ +echo '' +echo '-------------------------------------' +echo 'Start Deploying ......' +echo '-------------------------------------' + mkdir ./_deploy cd ./_deploy git init diff --git a/util/parse.sh b/util/parse.sh index 7203ba2..5bdb4c5 100644 --- a/util/parse.sh +++ b/util/parse.sh @@ -1,3 +1,8 @@ +echo '' +echo '-------------------------------------' +echo 'Parsing data ......' +echo '-------------------------------------' + for i in $@ do echo 'Parsing '${i}' data ......' From 854748b8992ccbb51d35731c8d393b4b04647755 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Mon, 20 Aug 2018 10:37:09 +0800 Subject: [PATCH 9/9] fix/ci: update travis.yml --- .travis.yml | 12 ++---------- run.sh | 4 +++- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1d18ccf..e62d8e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,13 +5,5 @@ dist: trusty install: - sudo apt-get --yes install libxml2-utils script: - - chmod +x ./checker.sh - - chmod +x ./combine.sh - - chmod +x ./util/xmlparser.sh - - chmod +x ./build.sh - - chmod +x ./deploy.sh - - ./checker.sh - - ./combine.sh - - ./xmlparser.sh tmp/chrome.xml > tmp/chrome_xml_parser_result.txt - - ./build.sh - - ./deploy.sh > /dev/null + - chmod +x ./run.sh + - ./run.sh diff --git a/run.sh b/run.sh index d05266d..df67273 100644 --- a/run.sh +++ b/run.sh @@ -14,7 +14,7 @@ chmod +x ./util/deployer.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.tpl tmp/chrome.xml +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 @@ -28,3 +28,5 @@ xmllint --noblanks 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 + +./util/deployer.sh