在网上看到别人写的脚本,不是很满意,自己就重写了一下。先把MeeGo的获取脚本给做了,后来想想Android也可以这么干,所以就把meego项目同步脚本改了改,基本上也能用上了。不过我个人还是推荐用repo的方式。代码基础是一样的,要改动的东西不算多。下面是脚本源码。

获取或者同步MeeGo项目源码的脚本: #!/bin/sh
#get_meego_projects.sh
REPO_MANI_DIR= "meego_manifest"
REPO_MANIFEST= "${REPO_MANI_DIR}/default.xml"
REPO_URL_BASE= "git://gitorious.org"

if [ -f ${REPO_MANI_DIR}/.git/config ]; then
( cd ${REPO_MANI_DIR} ; git pull )
else
git clone git://gitorious.org/repo-for-meego/meego_manifest.git
fi

#awk -F'name=|"' '/^[[:space:]]*<project/{print $2}' ${REPO_MANIFEST} | while read REPO_PATH
awk -F'path=|"' '/^[[:space:]]*<project/{print $3}' ${REPO_MANIFEST} | while read REPO_PATH
do
if [ -f ${REPO_PATH}/.git/config ]; then
echo "----------Begin updating ${REPO_PATH}----------"
( cd ${REPO_PATH} ; git pull )
echo "----------End updating ${REPO_PATH}----------"
else
echo "----------Begin cloning ${REPO_PATH}----------"
mkdir -p $(dirname ${REPO_PATH}) && git clone ${REPO_URL_BASE}/${REPO_PATH}.git ${REPO_PATH}
echo "----------End cloning ${REPO_PATH}----------"
fi
done 使用repo获取meego源码的方法: #!/bin/sh
#get_meego_repo.sh
REPO_TARGET_DIR= "/opt/meego/sources"
REPO_SOURCE_URL= "git://gitorious.org/repo-for-meego/meego_manifest.git"

curl http://android.git.kernel.org/repo > /usr/local/bin/repo
chmod a+x /usr/local/bin/repo
mkdir -p ${REPO_TARGET_DIR}
cd ${REPO_TARGET_DIR}
repo init -u ${REPO_SOURCE_URL}
repo sync
获取或者同步Android项目源码的脚本: #!/bin/sh
#get_android_source.sh
REPO_MANI_DIR= "manifest"
REPO_MANIFEST= "${REPO_MANI_DIR}/default.xml"
REPO_URL_BASE= "http://android.git.kernel.org/platform"

if [ -f ${REPO_MANI_DIR}/.git/config ]; then
( cd ${REPO_MANI_DIR} ; git pull )
else
git clone http://android.git.kernel.org/platform/manifest.git
fi


#awk -F'name=|"' '/^[[:space:]]*<project/{print $2}' ${REPO_MANIFEST} | while read REPO_PATH
awk -F'path=|"' '/^[[:space:]]*<project/{print $3}' ${REPO_MANIFEST} | while read REPO_PATH
do
if [ -f ${REPO_PATH}/.git/config ]; then
echo "----------Begin updating ${REPO_PATH}----------"
( cd ${REPO_PATH} ; git pull )
echo "----------End updating ${REPO_PATH}----------"
else
echo "----------Begin cloning ${REPO_PATH}----------"
mkdir -p $(dirname ${REPO_PATH}) && git clone ${REPO_URL_BASE}/${REPO_PATH}.git ${REPO_PATH}
echo "----------End cloning ${REPO_PATH}----------"
fi
done 使用repo获取android源码的方法: #!/bin/sh
#get_android_repo.sh
REPO_TARGET_DIR= "/opt/android/sources"
REPO_SOURCE_URL= "git://android.git.kernel.org/platform/manifest.git"

curl http://android.git.kernel.org/repo > /usr/local/bin/repo
chmod a+x /usr/local/bin/repo
mkdir -p ${REPO_TARGET_DIR}
cd ${REPO_TARGET_DIR}
repo init -u ${REPO_SOURCE_URL}
repo sync

更多相关文章

  1. Android(安卓)获取短信会话列表
  2. Android中的数据存储之文件存储、SharedPreferences和Pull解析
  3. Android源码设计模式学习笔记-MVC,MVP架构模式
  4. Android设备唯一标识的获取和构造
  5. 高德天气应用开发之三:android 自定义控件实现(ActionBar + PageI
  6. Android(安卓)图片缓存处理
  7. Android(安卓)SystemUI源码分析与修改
  8. Android(安卓)Gallery3D源码分析(一)
  9. Android(安卓)笔记:获取本机手机号(适用于双卡双待手机)

随机推荐

  1. ADO.NET实用实例介绍
  2. ADO.NET实现对SQL Server数据库的操作教
  3. Visual Studio Debugger中你所不知道的小
  4. ASP.NET一些经典的问题详解
  5. C#连接Oracle的实例教程
  6. 实现一个验证码生成类(含数字,拼音,汉字)
  7. SignalR Self Host多端消息推送服务实例(
  8. ASP.NET Core简单介绍教程(1)_实用技巧
  9. 带你掌握OOM框架AutoMapper使用实例
  10. SignalR Self Host多端消息推送服务介绍(