方法1:
使用清华镜像源
https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/
repo脚本仅供参保考
#!/bin/bash
in=0
sy=0
if [[ ! -d .repo ]]; then
#repo init
echo "================ Start repo init ================="
repo init -u git://github.com/CyanogenMod/android.git -b cm-12.0
while [[ $? != 0 ]]
┊ do
┊ ┊ let "in++"
┊ ┊ echo "/============== repo init failed $in times Retry ============="
┊ ┊ repo init -u git://github.com/CyanogenMod/android.git -b cm-12.0
┊ ┊ sleep 1
┊ done
#repo sync
echo "================ Start repo sync ================="
repo sync
while [[ $? != 0 ]]
┊ do
┊ ┊ let "sy++"
┊ ┊ echo "/============== repo sync failed $sy times with init $in times Retry ============="
┊ ┊ repo sync
┊ ┊ sleep 1
┊ done
#repo sync
else
echo "================ Start repo sync ================="
repo sync
while [[ $? != 0 ]]
┊ do
┊ ┊ let "sy++"
┊ ┊ echo "/============== repo sync failed $sy times with init $in times Retry ============="
┊ ┊ repo sync
┊ ┊ sleep 1
┊ done
fi