From 5fa73d9bad4bc6bc295c9247f668bfed45c8e982 Mon Sep 17 00:00:00 2001 From: neoFelhz Date: Wed, 8 Nov 2017 18:12:26 +0800 Subject: [PATCH] feat: combine all data into one xml --- checker.sh | 22 +++++------- combine.sh | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+), 13 deletions(-) create mode 100644 combine.sh diff --git a/checker.sh b/checker.sh index 5c9e4f4..c8bf1b2 100644 --- a/checker.sh +++ b/checker.sh @@ -1,4 +1,5 @@ mkdir ./public +mkdir ./tmp echo '-------------------------------------' echo 'Checking Chrome Stable x86 ......' @@ -14,7 +15,7 @@ curl "https://tools.google.com/service/update2" --data " - " > ./public/stable-x86.xml + " > ./tmp/stable-x86.unformat.xml echo '' echo '-------------------------------------' @@ -31,7 +32,7 @@ curl "https://tools.google.com/service/update2" --data " - " > ./public/stable-x64.xml + " > ./tmp/stable-x64.unformat.xml echo '' echo '-------------------------------------' @@ -48,7 +49,7 @@ curl "https://tools.google.com/service/update2" --data " - " > ./public/beta-x86.xml + " > ./tmp/beta-x86.unformat.xml echo '' echo '-------------------------------------' @@ -65,7 +66,7 @@ curl "https://tools.google.com/service/update2" --data " - " > ./public/beta-x64.xml + " > ./tmp/beta-x64.unformat.xml echo '' echo '-------------------------------------' @@ -82,7 +83,7 @@ curl "https://tools.google.com/service/update2" --data " - " > ./public/dev-x86.xml + " > ./tmp/dev-x86.unformat.xml echo '' echo '-------------------------------------' @@ -99,7 +100,7 @@ curl "https://tools.google.com/service/update2" --data " - " > ./public/dev-x64.xml + " > ./tmp/dev-x64.unformat.xml echo '' echo '-------------------------------------' @@ -116,7 +117,7 @@ curl "https://tools.google.com/service/update2" --data " - " > ./public/canary-x86.xml + " > ./tmp/canary-x86.unformat.xml echo '' echo '-------------------------------------' @@ -133,9 +134,4 @@ curl "https://tools.google.com/service/update2" --data " - " > ./public/canary-x64.xml - -DATE="$(echo $(date --rfc-2822))" -echo '' >> ./public/checktime.xml + " > ./tmp/canary-x64.unformat.xml diff --git a/combine.sh b/combine.sh new file mode 100644 index 0000000..d52c16c --- /dev/null +++ b/combine.sh @@ -0,0 +1,100 @@ +echo '' +echo '-------------------------------------' +echo 'Formatting XML Files ......' +echo '-------------------------------------' +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 '' + +echo '' > chrome.tmp.xml + +echo '' >> chrome.tmp.xml + +DATE="$(echo $(date --rfc-2822))" +echo '' >> chrome.tmp.xml + +echo '' +echo '-------------------------------------' +echo 'Formatting Output ......' +echo '-------------------------------------' +echo '' + +sed -i 's|">|"/>|g' chrome.tmp.xml +xmllint --format chrome.tmp.xml > chrome.xml + +echo '' +echo '-------------------------------------' +echo 'Compressing Output ......' +echo '-------------------------------------' +echo '' + +xmllint --noblanks chrome.xml > chrome.min.xml + +cp -rf ./chrome.xml ../public/chrome.xml +cp -rf ./chrome.min.xml ../public/chrome.min.xml + +cd ..