From 970dff144c94de1ce76576b2e8cef8d51bcb5da8 Mon Sep 17 00:00:00 2001 From: whyour Date: Wed, 15 Mar 2023 21:44:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=A2=E9=98=85=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=20http=20=E5=8D=8F=E8=AE=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/update.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/shell/update.sh b/shell/update.sh index 8e113b6c..44d5f937 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -152,19 +152,28 @@ update_raw() { local autoAddCron="$3" local autoDelCron="$4" - if [[ ! $autoAddCron ]];then + if [[ ! $autoAddCron ]]; then autoAddCron=${AutoAddCron} fi - if [[ ! $autoDelCron ]];then + if [[ ! $autoDelCron ]]; then autoDelCron=${AutoDelCron} fi + local proxyStr="" + if [[ $proxy ]]; then + if [[ $url == http:* ]]; then + proxyStr="-e \"http_proxy=${proxy}\"" + elif [[ $url == https:* ]]; then + proxyStr="-e \"http_proxy=${proxy};https_proxy=${proxy}\"" + fi + fi + local raw_url="$url" local suffix="${raw_url##*.}" local raw_file_name="${uniq_path}.${suffix}" echo -e "开始下载:${raw_url} \n\n保存路径:$dir_raw/${raw_file_name}\n" - wget -q --no-check-certificate -e "http_proxy=${proxy};https_proxy=${proxy}" -O "$dir_raw/${raw_file_name}.new" ${raw_url} + wget -q --no-check-certificate $proxyStr -O "$dir_raw/${raw_file_name}.new" ${raw_url} if [[ $? -eq 0 ]]; then mv "$dir_raw/${raw_file_name}.new" "$dir_raw/${raw_file_name}" @@ -297,11 +306,11 @@ diff_scripts() { local extensions="$6" local autoAddCron="$7" local autoDelCron="$8" - - if [[ ! $autoAddCron ]];then + + if [[ ! $autoAddCron ]]; then autoAddCron=${AutoAddCron} fi - if [[ ! $autoDelCron ]];then + if [[ ! $autoDelCron ]]; then autoDelCron=${AutoDelCron} fi