源码同步脚本

源码同步脚本
这是用来同步源码的一份脚本,使用的清华aosp镜像。由于同步过程中耗时久,所以不可避免的会出现网络中断等问题,所以写了脚本方便同步。如果失败会自动重试

#!/usr/bin/env bash
 
export LOG_ACCOUNT=tmp
export LOG_FILENAME=repo-sync
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
 
aosp_branch=android-11.0.0_r1
 
if [ ! -d ".repo" ]; then
    repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b $aosp_branch
    repo_stat=$?
    if [ $repo_stat -ne 0 ]; then
        log -o -- "init repo faild, please try again"
        exit 0
    fi
else
    log -o -- "local .repo dir exists"
fi
 
try_count=0
log -o -- "from remote sync aosp"
 
repo sync
repo_stat=$?
while [ $repo_stat -ne 0 ]; do
    log -o -- "sync faild, status: $repo_stat, try again in 5s ..."
    sleep 5
    repo sync
    repo_stat=$?
    ((try_count++))
done
 
log -o -- "sync repo over, try_count: $try_count"
log -o -unotify "sync over, success"
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值