2 Star 0 Fork 1

余诗/autorepo-for-baseos

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
cache_proxy_client.sh 1.45 KB
一键复制 编辑 原始数据 按行查看 历史
余诗 提交于 2023-10-11 07:10 . update cache_proxy_client.sh.
#! /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"
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yushi-Icy/autorepo-for-baseos.git
[email protected]:yushi-Icy/autorepo-for-baseos.git
yushi-Icy
autorepo-for-baseos
autorepo-for-baseos
master

搜索帮助