正在显示
5 个修改的文件
包含
40 行增加
和
177 行删除
@@ -8,7 +8,7 @@ RED="\\e[31m" | @@ -8,7 +8,7 @@ RED="\\e[31m" | ||
8 | GREEN="\\e[32m" | 8 | GREEN="\\e[32m" |
9 | YELLOW="\\e[33m" | 9 | YELLOW="\\e[33m" |
10 | BLACK="\\e[0m" | 10 | BLACK="\\e[0m" |
11 | -POS="\\e[110G" | 11 | +POS="\\e[100G" |
12 | 12 | ||
13 | # if need to log to file, change the log path. | 13 | # if need to log to file, change the log path. |
14 | if [[ ! $log ]]; then | 14 | if [[ ! $log ]]; then |
trunk/scripts/_mirror.utils.sh
已删除
100755 → 0
1 | -#!/bin/bash | ||
2 | - | ||
3 | -############################################# | ||
4 | -# help for the first checkout. | ||
5 | -############################################# | ||
6 | -function first_checkout() | ||
7 | -{ | ||
8 | - mirror_name=$1 | ||
9 | - git_url=$2 | ||
10 | - project_dir=$3 | ||
11 | - sync_script=$4 | ||
12 | - | ||
13 | - failed_msg "当前分支不是${mirror_name}镜像"; | ||
14 | - | ||
15 | - cat <<END | ||
16 | -创建${mirror_name}镜像的过程如下: | ||
17 | -1. 在${mirror_name}上创建项目, | ||
18 | - 可创建空项目,或从https://github.com/winlinvip/simple-rtmp-server拷贝过来。 | ||
19 | -2. 在本地虚拟机上: | ||
20 | - git clone $git_url | ||
21 | - cd $project_dir && git checkout master && git branch 1.0release && git push origin 1.0release | ||
22 | -3. 创建同步的branch: | ||
23 | - git remote add upstream https://github.com/winlinvip/simple-rtmp-server.git | ||
24 | - git fetch upstream | ||
25 | - git checkout upstream/master -b srs.master | ||
26 | - git checkout upstream/1.0release -b srs.1.0release | ||
27 | -4. 执行本同步更新脚本,更新。 | ||
28 | - bash $sync_script | ||
29 | -END | ||
30 | -} | ||
31 | - | ||
32 | -############################################# | ||
33 | -# branch master | ||
34 | -############################################# | ||
35 | -function sync_master() | ||
36 | -{ | ||
37 | - for ((;;)); do | ||
38 | - git checkout srs.master && git pull | ||
39 | - ret=$?; if [[ 0 -ne $ret ]]; then | ||
40 | - failed_msg "(master)更新github分支失败,自动重试"; | ||
41 | - continue | ||
42 | - else | ||
43 | - ok_msg "(master)更新github分支成功" | ||
44 | - fi | ||
45 | - break | ||
46 | - done | ||
47 | - | ||
48 | - git checkout master && git merge srs.master | ||
49 | - ret=$?; if [[ 0 -ne $ret ]]; then failed_msg "(master)合并github分支失败, ret=$ret"; exit $ret; fi | ||
50 | - ok_msg "(master)合并github分支成功" | ||
51 | -} | ||
52 | - | ||
53 | -############################################# | ||
54 | -# branch 1.0release | ||
55 | -############################################# | ||
56 | -function sync_1_0_release() | ||
57 | -{ | ||
58 | - for ((;;)); do | ||
59 | - git checkout srs.1.0release && git pull | ||
60 | - ret=$?; if [[ 0 -ne $ret ]]; then | ||
61 | - failed_msg "(1.0release)更新github分支失败,自动重试"; | ||
62 | - continue | ||
63 | - else | ||
64 | - ok_msg "(1.0release)更新github分支成功" | ||
65 | - fi | ||
66 | - break | ||
67 | - done | ||
68 | - | ||
69 | - git checkout 1.0release && git merge srs.1.0release | ||
70 | - ret=$?; if [[ 0 -ne $ret ]]; then failed_msg "(1.0release)合并github分支失败, ret=$ret"; exit $ret; fi | ||
71 | - ok_msg "(1.0release)合并github分支成功" | ||
72 | -} | ||
73 | - | ||
74 | -############################################# | ||
75 | -# push | ||
76 | -############################################# | ||
77 | -function sync_push() | ||
78 | -{ | ||
79 | - mirror_name=$1 | ||
80 | - | ||
81 | - for ((;;)); do | ||
82 | - git push | ||
83 | - ret=$?; if [[ 0 -ne $ret ]]; then | ||
84 | - failed_msg "提交${mirror_name}分支失败,自动重试"; | ||
85 | - continue | ||
86 | - else | ||
87 | - ok_msg "提交${mirror_name}分支成功" | ||
88 | - fi | ||
89 | - break | ||
90 | - done | ||
91 | - | ||
92 | - git checkout master | ||
93 | - ok_msg "${mirror_name}同步git成功" | ||
94 | -} | ||
95 | - |
trunk/scripts/csdn.mirror.sh
已删除
100755 → 0
1 | -#!/bin/bash | ||
2 | - | ||
3 | -echo "更新CSDN镜像的脚本" | ||
4 | - | ||
5 | -echo "argv[0]=$0" | ||
6 | -if [[ ! -f $0 ]]; then | ||
7 | - echo "directly execute the scripts on shell."; | ||
8 | - work_dir=`pwd` | ||
9 | -else | ||
10 | - echo "execute scripts in file: $0"; | ||
11 | - work_dir=`dirname $0`; work_dir=`(cd ${work_dir} && pwd)` | ||
12 | -fi | ||
13 | -work_dir=`(cd ${work_dir}/.. && pwd)` | ||
14 | -product_dir=$work_dir | ||
15 | - | ||
16 | -# allow start script from any dir | ||
17 | -cd $work_dir && git checkout master | ||
18 | - | ||
19 | -. ${product_dir}/scripts/_log.sh | ||
20 | -ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi | ||
21 | -ok_msg "导入脚本成功" | ||
22 | - | ||
23 | -source $work_dir/scripts/_mirror.utils.sh | ||
24 | - | ||
25 | -git remote -v|grep code.csdn.net >/dev/null 2>&1 | ||
26 | -ret=$?; if [[ 0 -ne $ret ]]; then | ||
27 | - first_checkout "CSDN" \ | ||
28 | - "git@code.csdn.net:winlinvip/srs-csdn.git" \ | ||
29 | - "srs-csdn" "$work_dir/scripts/csdn.mirror.sh" | ||
30 | - exit 0; | ||
31 | -fi | ||
32 | - | ||
33 | -sync_master | ||
34 | -sync_1_0_release | ||
35 | -sync_push "CSDN" | ||
36 | - | ||
37 | -exit 0 |
@@ -20,14 +20,46 @@ cd $work_dir && git checkout master | @@ -20,14 +20,46 @@ cd $work_dir && git checkout master | ||
20 | ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi | 20 | ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi |
21 | ok_msg "导入脚本成功" | 21 | ok_msg "导入脚本成功" |
22 | 22 | ||
23 | -source $work_dir/scripts/_mirror.utils.sh | 23 | +function remote_check() |
24 | +{ | ||
25 | + remote=$1 | ||
26 | + url=$2 | ||
27 | + git remote -v| grep "$url" >/dev/null 2>&1 | ||
28 | + ret=$?; if [[ 0 -ne $ret ]]; then | ||
29 | + echo "remote $remote not found, add by:" | ||
30 | + echo " git remote add $remote $url" | ||
31 | + exit -1 | ||
32 | + fi | ||
33 | + ok_msg "remote $remote ok, url is $url" | ||
34 | +} | ||
35 | +remote_check origin git@github.com:winlinvip/simple-rtmp-server.git | ||
36 | +remote_check srs.csdn git@code.csdn.net:winlinvip/srs-csdn.git | ||
37 | +remote_check srs.oschina git@git.oschina.net:winlinvip/srs.oschina.git | ||
24 | 38 | ||
25 | -git remote -v|grep github.com >/dev/null 2>&1 | ||
26 | -ret=$?; if [[ 0 -ne $ret ]]; then | ||
27 | - echo "current not under github.com branch" | ||
28 | - exit -1; | ||
29 | -fi | 39 | +function sync_push() |
40 | +{ | ||
41 | + repository=$1 | ||
42 | + branch=$2 | ||
43 | + | ||
44 | + for ((;;)); do | ||
45 | + git push $repository $branch | ||
46 | + ret=$?; if [[ 0 -ne $ret ]]; then | ||
47 | + failed_msg "提交$repository/$branch分支失败,自动重试"; | ||
48 | + continue | ||
49 | + else | ||
50 | + ok_msg "提交$repository/$branch分支成功" | ||
51 | + fi | ||
52 | + break | ||
53 | + done | ||
54 | + ok_msg "$repository/$branch同步git成功" | ||
55 | +} | ||
30 | 56 | ||
31 | -sync_push "Github" | 57 | +sync_push origin master |
58 | +sync_push origin 1.0release | ||
59 | +sync_push srs.csdn master | ||
60 | +sync_push srs.csdn 1.0release | ||
61 | +sync_push srs.oschina master | ||
62 | +sync_push srs.oschina 1.0release | ||
63 | +ok_msg "sync push ok" | ||
32 | 64 | ||
33 | exit 0 | 65 | exit 0 |
trunk/scripts/oschina.mirror.sh
已删除
100755 → 0
1 | -#!/bin/bash | ||
2 | - | ||
3 | -echo "更新OSChina镜像的脚本" | ||
4 | - | ||
5 | -echo "argv[0]=$0" | ||
6 | -if [[ ! -f $0 ]]; then | ||
7 | - echo "directly execute the scripts on shell."; | ||
8 | - work_dir=`pwd` | ||
9 | -else | ||
10 | - echo "execute scripts in file: $0"; | ||
11 | - work_dir=`dirname $0`; work_dir=`(cd ${work_dir} && pwd)` | ||
12 | -fi | ||
13 | -work_dir=`(cd ${work_dir}/.. && pwd)` | ||
14 | -product_dir=$work_dir | ||
15 | - | ||
16 | -# allow start script from any dir | ||
17 | -cd $work_dir && git checkout master | ||
18 | - | ||
19 | -. ${product_dir}/scripts/_log.sh | ||
20 | -ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi | ||
21 | -ok_msg "导入脚本成功" | ||
22 | - | ||
23 | -source $work_dir/scripts/_mirror.utils.sh | ||
24 | - | ||
25 | -git remote -v|grep git.oschina.net >/dev/null 2>&1 | ||
26 | -ret=$?; if [[ 0 -ne $ret ]]; then | ||
27 | - first_checkout "OSChina" \ | ||
28 | - "git@git.oschina.net:winlinvip/srs.oschina.git" \ | ||
29 | - "srs.oschina" "$work_dir/scripts/oschina.mirror.sh" | ||
30 | - exit 0; | ||
31 | -fi | ||
32 | - | ||
33 | -sync_master | ||
34 | -sync_1_0_release | ||
35 | -sync_push "OSChina" | ||
36 | - | ||
37 | -exit 0 |
-
请 注册 或 登录 后发表评论