mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
// 如果上述 URL 不可访问,可以用下面的:
//curl https://storage-googleapis.lug.ustc.edu.cn/git
//测试有效
//-repo-downloads/repo > ~/bin/repo
mkdir WORKING_DIRECTORY
cd WORKING_DIRECTORY
repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest
//其中repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest是清华提供的镜像源
//repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest是中国科技技术大学的镜像源
// 如果提示无法连接到 gerrit.googlesource.com,可以编辑 ~/bin/repo文件,把 REPO_URL 一行替换成下面的:
//REPO_URL = 'https://gerrit-googlesource.lug.ustc.edu.cn/git-repo'
repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b android-4.0.4_r2.1
vim autosync#!/bin/bash
echo "======start repo sync======"
repo sync
while [ $? == 1 ]; do
echo "======sync failed, re-sync again======"
sleep 3
repo sync
done
chomd a+x autosync
./autosync