winlin

Merge branch 'srs.master'

@@ -84,6 +84,29 @@ A big THANK YOU goes to: @@ -84,6 +84,29 @@ A big THANK YOU goes to:
84 * [FFMPEG](http://ffmpeg.org/) and [libx264](http://www.videolan.org/) group for SRS to use to transcode. 84 * [FFMPEG](http://ffmpeg.org/) and [libx264](http://www.videolan.org/) group for SRS to use to transcode.
85 * Guido van Rossum for creating Python for api-server for SRS. 85 * Guido van Rossum for creating Python for api-server for SRS.
86 86
  87 +## Mirrors
  88 +
  89 +Github: [https://github.com/winlinvip/simple-rtmp-server](https://github.com/winlinvip/simple-rtmp-server)
  90 +[Git Usage](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Git)
  91 +
  92 +```bash
  93 +git clone https://github.com/winlinvip/simple-rtmp-server.git
  94 +```
  95 +
  96 +CSDN: [https://code.csdn.net/winlinvip/srs-csdn](https://code.csdn.net/winlinvip/srs-csdn)
  97 +[Git Usage](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Git)
  98 +
  99 +```bash
  100 +git clone https://code.csdn.net/winlinvip/srs-csdn.git
  101 +```
  102 +
  103 +OSChina: [http://git.oschina.net/winlinvip/srs.oschina](http://git.oschina.net/winlinvip/srs.oschina)
  104 +[Git Usage](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Git)
  105 +
  106 +```bash
  107 +git clone https://git.oschina.net/winlinvip/srs.oschina.git
  108 +```
  109 +
87 ## Usage 110 ## Usage
88 111
89 <strong>Step 1:</strong> get SRS 112 <strong>Step 1:</strong> get SRS
@@ -133,23 +156,8 @@ Donation:<br/> @@ -133,23 +156,8 @@ Donation:<br/>
133 [http://www.ossrs.net/srs.release/donation/index.html](http://www.ossrs.net/srs.release/donation/index.html) 156 [http://www.ossrs.net/srs.release/donation/index.html](http://www.ossrs.net/srs.release/donation/index.html)
134 157
135 Donations:<br/> 158 Donations:<br/>
136 -[https://github.com/winlinvip/simple-rtmp-server/blob/master/DONATIONS.txt](https://github.com/winlinvip/simple-rtmp-server/blob/master/DONATIONS.txt)  
137 -  
138 -## Mirrors  
139 -  
140 -Github: [https://github.com/winlinvip/simple-rtmp-server](https://github.com/winlinvip/simple-rtmp-server)  
141 -[Git Usage](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Git)  
142 -  
143 -```bash  
144 -git clone https://github.com/winlinvip/simple-rtmp-server.git  
145 -```  
146 -  
147 -CSDN: [https://code.csdn.net/winlinvip/srs-csdn](https://code.csdn.net/winlinvip/srs-csdn)  
148 -[Git Usage](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Git)  
149 -  
150 -```bash  
151 -git clone https://code.csdn.net/winlinvip/srs-csdn.git  
152 -``` 159 +[https://github.com/winlinvip/simple-rtmp-server/blob/master/DONATIONS.txt]
  160 +(https://github.com/winlinvip/simple-rtmp-server/blob/master/DONATIONS.txt)
153 161
154 ## System Requirements 162 ## System Requirements
155 Supported operating systems and hardware: 163 Supported operating systems and hardware:
  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 +}
@@ -2,17 +2,6 @@ @@ -2,17 +2,6 @@
2 2
3 echo "更新CSDN镜像的脚本" 3 echo "更新CSDN镜像的脚本"
4 4
5 -# 创建CSDN镜像的过程如下:  
6 -# 1. 在CSDN上创建项目,从https://github.com/winlinvip/simple-rtmp-server拷贝过来。  
7 -# 2. 在本地虚拟机上:  
8 -# git clone git@code.csdn.net:winlinvip/srs-csdn.git  
9 -# 3. 创建同步的branch:  
10 -# git remote add upstream https://github.com/winlinvip/simple-rtmp-server.git  
11 -# git fetch upstream  
12 -# git checkout upstream/master -b srs.master  
13 -# 4. 执行本同步更新脚本,更新。  
14 -# bash scripts/csdn.mirror.sh  
15 -  
16 echo "argv[0]=$0" 5 echo "argv[0]=$0"
17 if [[ ! -f $0 ]]; then 6 if [[ ! -f $0 ]]; then
18 echo "directly execute the scripts on shell."; 7 echo "directly execute the scripts on shell.";
@@ -31,77 +20,18 @@ cd $work_dir @@ -31,77 +20,18 @@ cd $work_dir
31 ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi 20 ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi
32 ok_msg "导入脚本成功" 21 ok_msg "导入脚本成功"
33 22
  23 +source $work_dir/scripts/_mirror.utils.sh
  24 +
34 git remote -v|grep code.csdn.net >/dev/null 2>&1 25 git remote -v|grep code.csdn.net >/dev/null 2>&1
35 ret=$?; if [[ 0 -ne $ret ]]; then 26 ret=$?; if [[ 0 -ne $ret ]]; then
36 - failed_msg "当前分支不是CSDN镜像";  
37 - cat <<END  
38 -创建CSDN镜像的过程如下:  
39 -1. 在CSDN上创建项目,从https://github.com/winlinvip/simple-rtmp-server拷贝过来。  
40 -2. 在本地虚拟机上:  
41 - git clone git@code.csdn.net:winlinvip/srs-csdn.git  
42 - git checkout master && git branch 1.0release && git push origin 1.0release  
43 -3. 创建同步的branch:  
44 - git remote add upstream https://github.com/winlinvip/simple-rtmp-server.git  
45 - git fetch upstream  
46 - git checkout upstream/master -b srs.master  
47 - git checkout upstream/1.0release -b srs.1.0release  
48 -4. 执行本同步更新脚本,更新。  
49 - bash scripts/csdn.mirror.sh  
50 -END 27 + first_checkout "CSDN" \
  28 + "git@code.csdn.net:winlinvip/srs-csdn.git" \
  29 + "srs-csdn" "$work_dir/scripts/csdn.mirror.sh"
51 exit 0; 30 exit 0;
52 fi 31 fi
53 32
54 -#############################################  
55 -# branch master  
56 -#############################################  
57 -for ((;;)); do  
58 - git checkout srs.master && git pull  
59 - ret=$?; if [[ 0 -ne $ret ]]; then  
60 - failed_msg "(master)更新github分支失败,自动重试";  
61 - continue  
62 - else  
63 - ok_msg "(master)更新github分支成功"  
64 - fi  
65 - break  
66 -done  
67 -  
68 -git checkout master && git merge srs.master  
69 -ret=$?; if [[ 0 -ne $ret ]]; then failed_msg "(master)合并github分支失败, ret=$ret"; exit $ret; fi  
70 -ok_msg "(master)合并github分支成功"  
71 -  
72 -#############################################  
73 -# branch 1.0release  
74 -#############################################  
75 -for ((;;)); do  
76 - git checkout srs.1.0release && git pull  
77 - ret=$?; if [[ 0 -ne $ret ]]; then  
78 - failed_msg "(1.0release)更新github分支失败,自动重试";  
79 - continue  
80 - else  
81 - ok_msg "(1.0release)更新github分支成功"  
82 - fi  
83 - break  
84 -done  
85 -  
86 -git checkout 1.0release && git merge srs.1.0release  
87 -ret=$?; if [[ 0 -ne $ret ]]; then failed_msg "(1.0release)合并github分支失败, ret=$ret"; exit $ret; fi  
88 -ok_msg "(1.0release)合并github分支成功"  
89 -  
90 -#############################################  
91 -# push  
92 -#############################################  
93 -  
94 -for ((;;)); do  
95 - git push  
96 - ret=$?; if [[ 0 -ne $ret ]]; then  
97 - failed_msg "提交CSDN分支失败,自动重试";  
98 - continue  
99 - else  
100 - ok_msg "提交CSDN分支成功"  
101 - fi  
102 - break  
103 -done  
104 -  
105 -ok_msg "CSDN同步git成功" 33 +sync_master
  34 +sync_1_0_release
  35 +sync_push "CSDN"
106 36
107 exit 0 37 exit 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
  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