Android系统代码本地更新Linux shell脚本2
来源:互联网 发布:大数据可视化展示系统 编辑:程序博客网 时间:2024/06/06 00:01
Android系统代码本地更新Linux shell脚本2相当于Android系统代码本地更新(Linux系统)原理差不多、修改和使用方法更简单。可以带参数(脚本运行方法:./sync.sh Remote_repository_name Remote_Public_source Original_source Public_source Your_branch ),也可以到脚本中修改默认一些变量(RRN(Remote repository name) RPS(Remote public source) OS(Original source) PS(Public source) YB(Your branch))。脚本如下:sync.sh
#!/bin/bash########################################### User modified RRN RPS OS PS YB # Remote repository nameRRN=rk# Remote public sourceRPS=inet# Original sourceOS=sofia# Public sourcePS=inet# Your branchYB=weitf########################################### entry arguments: Remote_repository_name Remote_Public_source Original_source Public_source Your_branch if [ $# != 0 ]; then if [ $# \> 5 ]; then echo "ERROR: too many arguments" exit elif [ $# == 5 ]; then # Remote repository name RRN=$1 # Remote public source PS=$2 # Original source OS=$3 # Public source RPS=$4 # Your branch YB=$5 else if [ $# \< 5 ]; then echo "ERROR: missing arguments 5 --> your branch" fi if [ $# \< 4 ]; then echo "ERROR: missing arguments 4 --> Public branch" fi if [ $# \< 3 ]; then echo "ERROR: missing arguments 3 --> original branch" fi if [ $# \< 2 ]; then echo "ERROR: missing arguments 2 --> remote public branch" fi if [ $# \< 1 ]; then echo "ERROR: missing arguments 1 --> remote repository name" fi exit fielse echo "Default branch arguments" fi########################################### printf Original_source Public_source Your_branch Remote_repository_nameecho ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"echo "Remote repository name: $RRN"echo "Remote public source: $RPS"echo "Original source: $OS"echo "Public source: $PS"echo "Your branch: $YB"##########################################echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"echo "Check branch:repo branch"repo branch | tee branch.logBRANCH=`cat branch.log`branch_exist=0for i in $BRANCH; do if [ "$i" == "$OS" -o "$i" == "$PS" -o "$i" == "$YB" ]; then ((branch_exist++)) fidoneif [ $branch_exist != 3 ]; then echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo "ERROR: entry arguments invalid branch" exitfiif [ -f branch.log ]; then rm branch.logfi##########################################echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"echo "Check status:repo status"repo status | tee status.logSTATUS=`cat status.log`for i in $STATUS; do if [ "$i" == "-m" ];then break; fidoneif [ "$i" != "-m" ];then echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo "checkout $OS:repo checkout $OS" repo checkout $OS if [ $? -eq 0 ]; then echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo "Update project files:repo sync" repo sync echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo "checkout $PS:repo checkout $PS" repo checkout $PS echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo "Pull code:repo forall -c git pull $RRN $RPS" repo forall -c git pull $RRN $RPS echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo "checkout $YB:repo checkout $YB" repo checkout $YB echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo "Merge code:repo forall -c git merge $PS" repo forall -c git merge $PS echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo "Check status:repo status" repo status | tee status.log STATUS=`cat status.log` for j in $STATUS do # echo $j # modified by weitf @20150802 # if [ "$j" == "-m" ];then if [ "$j" == "Um" ];then echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo "Merge error: CONFLICT!!!!($(date -d "today" +"%Y.%m.%d %H:%M:%S"))" | tee -a sync.log exit fi done echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo "Push code:repo forall -c git push $RRN $YB:$RPS" # repo forall -c git push $RRN $YB:$RPS echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo "Push code:push finish!!!" echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo "sync finish($(date -d "today" +"%Y.%m.%d %H:%M:%S"))!!!" | tee -a sync.log fielse echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo "checkout $YB:repo checkout $YB" repo checkout $YB echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo "Check status:repo status" repo status echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo "Commit error:no commit($(date -d "today" +"%Y.%m.%d %H:%M:%S"))"| tee -a sync.logfi
0 0
- Android系统代码本地更新Linux shell脚本2
- Android系统代码本地更新linux shell脚本1
- 更新本地代码到服务器的shell脚本
- 更新本地代码到服务器的shell脚本
- shell--linux系统脚本
- <Linux> Shell脚本(持续更新)
- Linux 系统命令及shell脚本2
- Android系统开发之路--Linux shell脚本
- shell 初始化linux系统脚本
- linux系统-shell编程-几个shell脚本
- Android linux shell 脚本书写
- linux中mysql备份shell脚本代码
- linux shell脚本获取git代码
- linux中mysql备份shell脚本代码
- Linux系统中的Shell脚本调试技术
- Linux 系统学习 之 shell脚本学习
- Linux系统中的Shell脚本调试技术
- Linux系统初始化优化Shell脚本
- 【数论】zoj3870
- HDU 5289 单调队列,multiset
- git学习笔记-5 git 暂存区(2)
- 阿里笔试题
- Apple Watch 开发探索日志 (一)
- Android系统代码本地更新Linux shell脚本2
- mac中使用svn
- NYOJ 86 找球号(一)
- android解决相机开关的问题
- git学习笔记-6 git reset(重置)
- vi与gedit的区别
- 关于stm32用J-link,ITM机制下动态调试
- git学习笔记-7 git checkout 切换分支
- OC_字典