正在显示
1 个修改的文件
包含
65 行增加
和
0 行删除
trunk/scripts/csdn.mirror.sh
0 → 100755
1 | +#!/bin/bash | ||
2 | + | ||
3 | +echo "更新CSDN镜像的脚本" | ||
4 | + | ||
5 | +# 创建CSDN镜像的过程如下: | ||
6 | +# 1. 在CSDN上创建项目,从https://github.com/winlinvip/simple-rtmp-server拷贝过来。 | ||
7 | +# 2. 在本地虚拟机上:git clone git@code.csdn.net:winlinvip/srs-csdn.git | ||
8 | +# 3. 创建同步的branch: | ||
9 | +# git remote add upstream https://github.com/winlinvip/simple-rtmp-server.git | ||
10 | +# git fetch upstream | ||
11 | +# git checkout upstream/master -b srs.master | ||
12 | +# 4. 执行本同步更新脚本,更新。 | ||
13 | +# bash scripts/csdn.mirror.sh | ||
14 | + | ||
15 | +echo "argv[0]=$0" | ||
16 | +if [[ ! -f $0 ]]; then | ||
17 | + echo "directly execute the scripts on shell."; | ||
18 | + work_dir=`pwd` | ||
19 | +else | ||
20 | + echo "execute scripts in file: $0"; | ||
21 | + work_dir=`dirname $0`; work_dir=`(cd ${work_dir} && pwd)` | ||
22 | +fi | ||
23 | +work_dir=`(cd ${work_dir}/.. && pwd)` | ||
24 | +product_dir=$work_dir | ||
25 | + | ||
26 | +. ${product_dir}/scripts/_log.sh | ||
27 | +ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi | ||
28 | +ok_msg "导入脚本成功" | ||
29 | + | ||
30 | +for ((;;)); do | ||
31 | + git checkout srs.master && git pull | ||
32 | + ret=$?; if [[ 0 -ne $ret ]]; then | ||
33 | + failed_msg "更新github分支失败,自动重试"; | ||
34 | + continue | ||
35 | + else | ||
36 | + ok_msg "更新github分支成功" | ||
37 | + fi | ||
38 | + break | ||
39 | +done | ||
40 | + | ||
41 | +git checkout master && git merge srs.master | ||
42 | +ret=$?; if [[ 0 -ne $ret ]]; then failed_msg "合并github分支失败, ret=$ret"; exit $ret; fi | ||
43 | +ok_msg "合并github分支成功" | ||
44 | + | ||
45 | +git commit -a -m "merge from github.srs" | ||
46 | +ret=$?; if [[ 0 -ne $ret ]]; then | ||
47 | + warn_msg "提交CSDN失败,忽略, ret=$ret"; | ||
48 | +else | ||
49 | + ok_msg "提交CSDN成功" | ||
50 | +fi | ||
51 | + | ||
52 | +for ((;;)); do | ||
53 | + git push | ||
54 | + ret=$?; if [[ 0 -ne $ret ]]; then | ||
55 | + failed_msg "提交CSDN分支失败,自动重试"; | ||
56 | + continue | ||
57 | + else | ||
58 | + ok_msg "提交CSDN分支成功" | ||
59 | + fi | ||
60 | + break | ||
61 | +done | ||
62 | + | ||
63 | +ok_msg "CSDN同步git成功" | ||
64 | + | ||
65 | +exit 0 |
-
请 注册 或 登录 后发表评论