From d29f423f9ba971eb7d7ff87d99ca52c5e2fc6fb3 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Tue, 17 Oct 2023 00:14:27 +0800 Subject: [PATCH 1/2] update script --- README.md | 2 +- tools/chromium.sh | 1 + tools/download-chromium-extension.sh | 1 - tools/download-chromium.sh | 2 +- tools/firefox-web-ext.sh | 1 + tools/firefox.sh | 1 + 6 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b6fa7133..19f70eaf 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ Chrome 安装方法(Google 被墙了上不去): # 克隆源代码 git clone -b master https://gitee.com/mirrors/replacegooglecdn.git --depth=1 --progress # 或者 -git clone -b master https://gitcode.net/mirrors/justjavac/replacegooglecdn.git --depth=1 --progress +git clone -b master https://gitcode.com/mirrors/justjavac/replacegooglecdn.git --depth=1 --progress # 更新源代码 diff --git a/tools/chromium.sh b/tools/chromium.sh index 45083460..45b39588 100644 --- a/tools/chromium.sh +++ b/tools/chromium.sh @@ -39,6 +39,7 @@ case $OS in ;; *) echo 'current script no support !' + exit 0 ;; esac diff --git a/tools/download-chromium-extension.sh b/tools/download-chromium-extension.sh index d24450a2..07cc0048 100644 --- a/tools/download-chromium-extension.sh +++ b/tools/download-chromium-extension.sh @@ -42,7 +42,6 @@ while [ $# -gt 0 ]; do export HTTPS_PROXY="$2" export NO_PROXY="127.0.0.1,localhost,127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16,198.18.0.0/15,169.254.0.0/16" export NO_PROXY="${NO_PROXY},localhost,.npmmirror.com,.aliyuncs.com,.taobao.org,.tsinghua.edu.cn,.ustc.edu.cn,.aliyun.com" - shift ;; *) ;; diff --git a/tools/download-chromium.sh b/tools/download-chromium.sh index 6460dfed..72050e8f 100644 --- a/tools/download-chromium.sh +++ b/tools/download-chromium.sh @@ -29,7 +29,6 @@ while [ $# -gt 0 ]; do export HTTPS_PROXY="$2" export NO_PROXY="127.0.0.1,localhost,127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16,198.18.0.0/15,169.254.0.0/16" export NO_PROXY="${NO_PROXY},localhost,.npmmirror.com,.aliyuncs.com,.taobao.org,.tsinghua.edu.cn,.ustc.edu.cn,.aliyun.com" - shift ;; --official) # Download Chromium @@ -112,6 +111,7 @@ case $OS in ;; *) echo 'no match OS' + exit 0 ;; esac diff --git a/tools/firefox-web-ext.sh b/tools/firefox-web-ext.sh index 821bb7c6..24fea309 100644 --- a/tools/firefox-web-ext.sh +++ b/tools/firefox-web-ext.sh @@ -35,6 +35,7 @@ UUID='' ;; *) echo 'current script no support !' + exit 0 ;; esac diff --git a/tools/firefox.sh b/tools/firefox.sh index 6c681224..ce56840d 100644 --- a/tools/firefox.sh +++ b/tools/firefox.sh @@ -35,6 +35,7 @@ UUID='' ;; *) echo 'current script no support !' + exit 0 ;; esac From 025d20ddf5678b87785b72dcd704062f00f744f7 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Tue, 17 Oct 2023 00:29:10 +0800 Subject: [PATCH 2/2] update --- tools/chromium.sh | 16 +++++++------- tools/download-chromium.sh | 43 +++++++++++++++++++------------------- tools/firefox.sh | 38 ++++++++++++++++----------------- 3 files changed, 48 insertions(+), 49 deletions(-) diff --git a/tools/chromium.sh b/tools/chromium.sh index 45b39588..a883abb6 100644 --- a/tools/chromium.sh +++ b/tools/chromium.sh @@ -25,22 +25,22 @@ CHROMIUM='' case $OS in "Linux") - UUID=$(cat /proc/sys/kernel/random/uuid) - CHROMIUM='chrome-linux/chrome' + UUID=$(cat /proc/sys/kernel/random/uuid) + CHROMIUM='chrome-linux/chrome' ;; "Darwin") - UUID=$(uuidgen) - CHROMIUM='chrome-mac/Chromium.app/Contents/MacOS/Chromium' + UUID=$(uuidgen) + CHROMIUM='chrome-mac/Chromium.app/Contents/MacOS/Chromium' ;; "MINGW64_NT") - # set chrome_user_data_dir='C:\Users\%username%\Local" "Settings\Temp\chrome-user-data' - # IF NOT EXIST %chrome_user_data_dir% MD %chrome_user_data_dir% - CHROMIUM='chrome-win\\chrome.exe' + # set chrome_user_data_dir='C:\Users\%username%\Local" "Settings\Temp\chrome-user-data' + # IF NOT EXIST %chrome_user_data_dir% MD %chrome_user_data_dir% + CHROMIUM='chrome-win\\chrome.exe' ;; *) echo 'current script no support !' exit 0 - ;; + ;; esac test -d /tmp/${UUID} || mkdir -p /tmp/${UUID} diff --git a/tools/download-chromium.sh b/tools/download-chromium.sh index 72050e8f..a84844a0 100644 --- a/tools/download-chromium.sh +++ b/tools/download-chromium.sh @@ -25,43 +25,42 @@ DOWNLOAD_CHROMIUM_URL='' while [ $# -gt 0 ]; do case "$1" in --proxy) - export HTTP_PROXY="$2" - export HTTPS_PROXY="$2" - export NO_PROXY="127.0.0.1,localhost,127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16,198.18.0.0/15,169.254.0.0/16" - export NO_PROXY="${NO_PROXY},localhost,.npmmirror.com,.aliyuncs.com,.taobao.org,.tsinghua.edu.cn,.ustc.edu.cn,.aliyun.com" + export HTTP_PROXY="$2" + export HTTPS_PROXY="$2" + export NO_PROXY="127.0.0.1,localhost,127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16,198.18.0.0/15,169.254.0.0/16" + export NO_PROXY="${NO_PROXY},localhost,.npmmirror.com,.aliyuncs.com,.taobao.org,.tsinghua.edu.cn,.ustc.edu.cn,.aliyun.com" ;; --official) - # Download Chromium - ## https://www.chromium.org/getting-involved/download-chromium/#downloading-old-builds-of-chrome-chromium - ## https://commondatastorage.googleapis.com/chromium-browser-snapshots/ + # Download Chromium + ## https://www.chromium.org/getting-involved/download-chromium/#downloading-old-builds-of-chrome-chromium + ## https://commondatastorage.googleapis.com/chromium-browser-snapshots/ - ## LAST_CHANGE xml format - LASTCHANGE_URL=https://commondatastorage.googleapis.com/chromium-browser-snapshots/ + ## LAST_CHANGE xml format + LASTCHANGE_URL=https://commondatastorage.googleapis.com/chromium-browser-snapshots/ case $OS in "Linux") - LASTCHANGE_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2FLAST_CHANGE?alt=media" - REVISION=$(curl -s -S $LASTCHANGE_URL) - echo "latest revision is $REVISION" - DOWNLOAD_CHROMIUM_URL="https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/$REVISION/chrome-linux.zip" + LASTCHANGE_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2FLAST_CHANGE?alt=media" + REVISION=$(curl -s -S $LASTCHANGE_URL) + echo "latest revision is $REVISION" + DOWNLOAD_CHROMIUM_URL="https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/$REVISION/chrome-linux.zip" ;; "Darwin") - LASTCHANGE_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Mac%2FLAST_CHANGE?alt=media" - REVISION=$(curl -s -S $LASTCHANGE_URL) - echo "latest revision is $REVISION" - DOWNLOAD_CHROMIUM_URL="https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/$REVISION/chrome-mac.zip" + LASTCHANGE_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Mac%2FLAST_CHANGE?alt=media" + REVISION=$(curl -s -S $LASTCHANGE_URL) + echo "latest revision is $REVISION" + DOWNLOAD_CHROMIUM_URL="https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/$REVISION/chrome-mac.zip" ;; 'MINGW64_NT'* | 'MSYS_NT'*) - LASTCHANGE_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Win_x64%2FLAST_CHANGE?alt=media" - REVISION=$(curl -s -S $LASTCHANGE_URL) - echo "latest revision is $REVISION" - DOWNLOAD_CHROMIUM_URL="https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/$REVISION/chrome-win.zip" + LASTCHANGE_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Win_x64%2FLAST_CHANGE?alt=media" + REVISION=$(curl -s -S $LASTCHANGE_URL) + echo "latest revision is $REVISION" + DOWNLOAD_CHROMIUM_URL="https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/$REVISION/chrome-win.zip" ;; esac ;; *) ;; - esac shift $(($# > 0 ? 1 : 0)) done diff --git a/tools/firefox.sh b/tools/firefox.sh index ce56840d..c86d805e 100644 --- a/tools/firefox.sh +++ b/tools/firefox.sh @@ -19,25 +19,25 @@ echo "$OS" FIREFOX='' UUID='' - case $OS in - "Linux") - UUID=$(cat /proc/sys/kernel/random/uuid) - FIREFOX=${__PROJECT__}/var/firefox/firefox - ;; - "Darwin") - UUID=$(uuidgen) - # macos firefox 默认启动目录 - FIREFOX='/Applications/Firefox.app/Contents/MacOS/firefox' - # 自定义 启动目录 - FIREFOX="${__PROJECT__}/var/Firefox/Firefox.app/Contents/MacOS/firefox-bin" - ;; - 'MINGW64_NT'* | 'MSYS_NT'*) - ;; - *) - echo 'current script no support !' - exit 0 - ;; - esac +case $OS in +"Linux") + UUID=$(cat /proc/sys/kernel/random/uuid) + FIREFOX=${__PROJECT__}/var/firefox/firefox + ;; +"Darwin") + UUID=$(uuidgen) + # macos firefox 默认启动目录 + FIREFOX='/Applications/Firefox.app/Contents/MacOS/firefox' + # 自定义 启动目录 + FIREFOX="${__PROJECT__}/var/Firefox/Firefox.app/Contents/MacOS/firefox-bin" + ;; +'MINGW64_NT'* | 'MSYS_NT'*) + ;; +*) + echo 'current script no support !' + exit 0 +;; +esac profile_folder="/tmp/${UUID}"