国内 repo 拉取android源码

针对国内网络环境的处理(无需FQ)
sudo gedit /etc/hosts
复制代码
在hosts文件中加入
203.208.49.187 googlesource.com
203.208.49.187 android.googlesource.com
203.208.49.187 gerrit.googlesource.com
复制代码
注意,203.208.49.187只是我这里临时获取的ip,请替换成适合你的地区的ip,具体获取方法如下

ping ad.doubleclick.net


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


你可能感兴趣的:(源码,android,网络,脚本,git)