diff --git a/.travis.yml b/.travis.yml index 2ab6d04..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 ./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/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 diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..df67273 --- /dev/null +++ b/run.sh @@ -0,0 +1,32 @@ +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.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 + +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 + +./util/deployer.sh diff --git a/src/chrome.xml b/src/chrome.xml new file mode 100644 index 0000000..1648bbd --- /dev/null +++ b/src/chrome.xml @@ -0,0 +1,76 @@ + + + + + {{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}} + + 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}}

diff --git a/checker.sh b/util/checker.sh similarity index 74% rename from checker.sh rename to util/checker.sh index 8401483..cc31d3c 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,13 @@ curl "https://tools.google.com/service/update2" --data " - " > ./tmp/stable-x86.unformat.xml + " > ./tmp/checker/stable-x86.xml + +sleep 1 -echo '' -echo '-------------------------------------' echo 'Checking Chrome Stable x64 ......' -echo '-------------------------------------' -curl "https://tools.google.com/service/update2" --data " +curl -s "https://tools.google.com/service/update2" --data " @@ -30,14 +28,13 @@ curl "https://tools.google.com/service/update2" --data " - " > ./tmp/stable-x64.unformat.xml + " > ./tmp/checker/stable-x64.xml + +sleep 1 -echo '' -echo '-------------------------------------' echo 'Checking Chrome Beta x86 ......' -echo '-------------------------------------' -curl "https://tools.google.com/service/update2" --data " +curl -s "https://tools.google.com/service/update2" --data " @@ -46,14 +43,13 @@ curl "https://tools.google.com/service/update2" --data " - " > ./tmp/beta-x86.unformat.xml + " > ./tmp/checker/beta-x86.xml + +sleep 1 -echo '' -echo '-------------------------------------' echo 'Checking Chrome Beta x64 ......' -echo '-------------------------------------' -curl "https://tools.google.com/service/update2" --data " +curl -s "https://tools.google.com/service/update2" --data " @@ -62,14 +58,13 @@ curl "https://tools.google.com/service/update2" --data " - " > ./tmp/beta-x64.unformat.xml + " > ./tmp/checker/beta-x64.xml + +sleep 1 -echo '' -echo '-------------------------------------' echo 'Checking Chrome Dev x86 ......' -echo '-------------------------------------' -curl "https://tools.google.com/service/update2" --data " +curl -s "https://tools.google.com/service/update2" --data " @@ -78,14 +73,13 @@ curl "https://tools.google.com/service/update2" --data " - " > ./tmp/dev-x86.unformat.xml + " > ./tmp/checker/dev-x86.xml + +sleep 1 -echo '' -echo '-------------------------------------' echo 'Checking Chrome Dev x64 ......' -echo '-------------------------------------' -curl "https://tools.google.com/service/update2" --data " +curl -s "https://tools.google.com/service/update2" --data " @@ -94,14 +88,13 @@ curl "https://tools.google.com/service/update2" --data " - " > ./tmp/dev-x64.unformat.xml + " > ./tmp/checker/dev-x64.xml + +sleep 1 -echo '' -echo '-------------------------------------' echo 'Checking Chrome Canary x86 ......' -echo '-------------------------------------' -curl "https://tools.google.com/service/update2" --data " +curl -s "https://tools.google.com/service/update2" --data " @@ -110,14 +103,13 @@ curl "https://tools.google.com/service/update2" --data " - " > ./tmp/canary-x86.unformat.xml + " > ./tmp/checker/canary-x86.xml + +sleep 1 -echo '' -echo '-------------------------------------' echo 'Checking Chrome Canary x64 ......' -echo '-------------------------------------' -curl "https://tools.google.com/service/update2" --data " +curl -s "https://tools.google.com/service/update2" --data " @@ -126,4 +118,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/deploy.sh b/util/deployer.sh similarity index 77% rename from deploy.sh rename to util/deployer.sh index da5e8c5..a6133da 100644 --- a/deploy.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/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 diff --git a/util/parse.sh b/util/parse.sh new file mode 100644 index 0000000..5bdb4c5 --- /dev/null +++ b/util/parse.sh @@ -0,0 +1,29 @@ +echo '' +echo '-------------------------------------' +echo 'Parsing data ......' +echo '-------------------------------------' + +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 '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 '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 99% rename from xmlparser.sh rename to util/xmlparser.sh index 47abc76..92a2b80 100644 --- a/xmlparser.sh +++ b/util/xmlparser.sh @@ -124,5 +124,5 @@ read_xml() { : done < "$1" } - + read_xml "$1"