代码拉取完成,页面将自动刷新
#! /bin/bash
init_excel() {
xls="result.xls"
echo -e "repo\tcache-proxy\twget" > "$xls"
}
#! /bin/bash
download_source()
{
local spec_sources=$(spectool -S "$1" | awk -F ': ' '{print $2}')
local sources=()
for source in $spec_sources; do
if [[ $source == http:* ]]; then
sources[${#sources[*]}]="$source"
fi
if [[ $source == https:* ]]; then
sources[${#sources[*]}]="$source"
fi
done
local proxy="https://cache-proxy.test.osinfra.cn/download"
for source in "${sources[@]}"; do
echo $source
local obs_source=$proxy/$source
wget $obs_source -P $2
local base_name=`basename $source`
if [ ! -f "$2/$base_name" ]; then
echo "Failed to download from cache-proxy.Start downloading from the official website."
cache_status="fail"
echo "====================================================>"
wget $source -P $2
if [ ! -f "$2/$base_name" ]; then
wget_status="fail"
else
wget_status="success"
fi
else
cache_status="success"
fi
echo -e "$3\t$cache_status\t$wget_status" >> "result.xls"
done
}
spec_dir="/root/autorepo-for-baseos/spec"
output="/root/autorepo-for-baseos/source"
pkgs_txt="PackageList.txt"
mkdir -p "$output"
init_excel
while IFS= read -r spec_name; do
echo "$spec_name"
download_source "$spec_dir/$spec_name.spec" "$output" "$spec_name"
echo "==========================================================================================================="
done < "$pkgs_txt"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。