Repo脚本
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
这边应该还要将repo加到/usr/bin/下面
创建本地库的脚本
这边使用的我自己修改的过的repo,方便不能翻墙的朋友测试,不过用官方的repo也是可以的,需要手动修改下面一句代码。
附件地址
下载附件解包后,里面的clone.bundle,repo,sh脚本都要在同一级目录,不然会自动联网下载。
#!/bin/sh
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
curDir=`pwd`
mkdir reposerver
cd reposerver
serverDir=`pwd`
git init --bare manifest.git
git init --bare app1.git
git init --bare app2.git
cd ../
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
git clone reposerver/manifest.git
cd manifest
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<manifest>
<remote name=\"reposerver\" fetch=\"$serverDir\" review=\"review.source.android.com\" />
<default revision=\"master\" remote=\"reposerver\" />
<project path=\"app1\" name=\"app1\" />
<project path=\"app2\" name=\"app2\" />
</manifest>" > default.xml
git add default.xml
git commit -am "add default.xml"
git push origin master:master
cd ..
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
git clone reposerver/app1.git
cd app1
echo "Hello world!" > hw1
git add hw1
git commit -am "add file"
git push origin master:master
cd ..
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
git clone reposerver/app2.git
cd app2
echo "Hello world!" > hw2
git add hw2
git commit -am "add file"
git push origin master:master
cd ..
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
mkdir repoclient
cd repoclient
cp ../clone.bundle ./
cp ../repo ./
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++use local repo
python ./repo init -u $curDir/reposerver/manifest.git
#repo init -u $curDir/reposerver/manifest.git
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
repo sync
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
repo info