歡迎您光臨本站 註冊首頁

獲取或同步MeeGo和Android項目源碼的腳本[修改稿]

←手機掃碼閱讀     火星人 @ 2014-03-09 , reply:0
在網上看到別人寫的腳本,不是很滿意,自己就重寫了一下.先把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

本文出自 「阿泰—開源尋徑」 博客,請務必保留此出處http://floss.blog.51cto.com/683157/488468


[火星人 ] 獲取或同步MeeGo和Android項目源碼的腳本[修改稿]已經有578次圍觀

http://coctec.com/docs/linux/show-post-49349.html