fix bug of typo of readme. update package to support --help and options
正在显示
2 个修改的文件
包含
55 行增加
和
12 行删除
| @@ -81,7 +81,7 @@ cd simple-rtmp-server/trunk | @@ -81,7 +81,7 @@ cd simple-rtmp-server/trunk | ||
| 81 | ## System Requirements | 81 | ## System Requirements |
| 82 | Supported operating systems and hardware: | 82 | Supported operating systems and hardware: |
| 83 | * All Linux , both 32 and 64 bits | 83 | * All Linux , both 32 and 64 bits |
| 84 | -* All handware. | 84 | +* All hardware. |
| 85 | 85 | ||
| 86 | ## Summary | 86 | ## Summary |
| 87 | 01. Simple: also stable enough.<br/> | 87 | 01. Simple: also stable enough.<br/> |
| @@ -7,13 +7,46 @@ | @@ -7,13 +7,46 @@ | ||
| 7 | # user can config the following configs, then package. | 7 | # user can config the following configs, then package. |
| 8 | INSTALL=/usr/local/srs | 8 | INSTALL=/usr/local/srs |
| 9 | # whether build for arm, only for ubuntu12. | 9 | # whether build for arm, only for ubuntu12. |
| 10 | +help=NO | ||
| 10 | ARM=NO | 11 | ARM=NO |
| 12 | +DO_BUILD=YES | ||
| 11 | 13 | ||
| 12 | ################################################################################## | 14 | ################################################################################## |
| 13 | ################################################################################## | 15 | ################################################################################## |
| 14 | ################################################################################## | 16 | ################################################################################## |
| 15 | # parse options. | 17 | # parse options. |
| 16 | -if [[ $1 == "arm" ]]; then ARM=YES; fi | 18 | +for option |
| 19 | +do | ||
| 20 | + case "$option" in | ||
| 21 | + -*=*) | ||
| 22 | + value=`echo "$option" | sed -e 's|[-_a-zA-Z0-9/]*=||'` | ||
| 23 | + option=`echo "$option" | sed -e 's|=[-_a-zA-Z0-9/]*||'` | ||
| 24 | + ;; | ||
| 25 | + *) value="" ;; | ||
| 26 | + esac | ||
| 27 | + | ||
| 28 | + case "$option" in | ||
| 29 | + --help) help=yes ;; | ||
| 30 | + | ||
| 31 | + --arm) ARM=YES ;; | ||
| 32 | + --no-build) DO_BUILD=NO ;; | ||
| 33 | + | ||
| 34 | + *) | ||
| 35 | + echo "$0: error: invalid option \"$option\"" | ||
| 36 | + exit 1 | ||
| 37 | + ;; | ||
| 38 | + esac | ||
| 39 | +done | ||
| 40 | +if [ $help = yes ]; then | ||
| 41 | + cat << END | ||
| 42 | + | ||
| 43 | + --help print this message | ||
| 44 | + | ||
| 45 | + --arm configure with arm and make srs. use arm tools to get info. | ||
| 46 | + --no-build donot build srs, user has builded. only make install. | ||
| 47 | +END | ||
| 48 | + exit 0 | ||
| 49 | +fi | ||
| 17 | 50 | ||
| 18 | # discover the current work dir, the log and access. | 51 | # discover the current work dir, the log and access. |
| 19 | echo "argv[0]=$0" | 52 | echo "argv[0]=$0" |
| @@ -36,28 +69,38 @@ ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi | @@ -36,28 +69,38 @@ ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi | ||
| 36 | os_name=`lsb_release --id|awk '{print $3}'` && | 69 | os_name=`lsb_release --id|awk '{print $3}'` && |
| 37 | os_release=`lsb_release --release|awk '{print $2}'` && | 70 | os_release=`lsb_release --release|awk '{print $2}'` && |
| 38 | os_major_version=`echo $os_release|awk -F '.' '{print $1}'` && | 71 | os_major_version=`echo $os_release|awk -F '.' '{print $1}'` && |
| 39 | -os_machine=`uname -i` | 72 | +os_machine=`uname -i`; if [[ "unknown" == $os_machine ]]; then os_machine=`uname -m`; fi |
| 40 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "lsb_release get os info failed."; exit $ret; fi | 73 | ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "lsb_release get os info failed."; exit $ret; fi |
| 41 | ok_msg "target os is ${os_name}-${os_major_version} ${os_release} ${os_machine}" | 74 | ok_msg "target os is ${os_name}-${os_major_version} ${os_release} ${os_machine}" |
| 42 | 75 | ||
| 43 | # build srs | 76 | # build srs |
| 44 | # @see https://github.com/winlinvip/simple-rtmp-server/wiki/Build | 77 | # @see https://github.com/winlinvip/simple-rtmp-server/wiki/Build |
| 45 | -ok_msg "start build srs" | ||
| 46 | -if [ $ARM = YES ]; then | 78 | +if [ $DO_BUILD = YES ]; then |
| 79 | + ok_msg "start build srs" | ||
| 80 | + if [ $ARM = YES ]; then | ||
| 47 | ( | 81 | ( |
| 48 | cd $work_dir && | 82 | cd $work_dir && |
| 49 | - ./configure --with-ssl --with-arm-ubuntu12 --prefix=$INSTALL && | ||
| 50 | - make && rm -rf $package_dir && make DESTDIR=$package_dir install | 83 | + ./configure --with-ssl --with-arm-ubuntu12 --prefix=$INSTALL && make |
| 51 | ) >> $log 2>&1 | 84 | ) >> $log 2>&1 |
| 52 | -else | 85 | + else |
| 53 | ( | 86 | ( |
| 54 | cd $work_dir && | 87 | cd $work_dir && |
| 55 | - ./configure --with-ssl --with-hls --with-nginx --with-ffmpeg --with-http-callback --prefix=$INSTALL && | ||
| 56 | - make && rm -rf $package_dir && make DESTDIR=$package_dir install | 88 | + ./configure --with-ssl --with-hls --with-nginx --with-ffmpeg --with-http-callback --prefix=$INSTALL && make |
| 57 | ) >> $log 2>&1 | 89 | ) >> $log 2>&1 |
| 90 | + fi | ||
| 91 | + ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "build srs failed"; exit $ret; fi | ||
| 92 | + ok_msg "build srs success" | ||
| 93 | +else | ||
| 94 | + ok_msg "user skip build, directly install" | ||
| 58 | fi | 95 | fi |
| 59 | -ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "build srs failed"; exit $ret; fi | ||
| 60 | -ok_msg "build srs success" | 96 | + |
| 97 | +# install srs | ||
| 98 | +ok_msg "start install srs" | ||
| 99 | +( | ||
| 100 | + cd $work_dir && rm -rf $package_dir && make DESTDIR=$package_dir install | ||
| 101 | +) >> $log 2>&1 | ||
| 102 | +ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "install srs failed"; exit $ret; fi | ||
| 103 | +ok_msg "install srs success" | ||
| 61 | 104 | ||
| 62 | # copy extra files to package. | 105 | # copy extra files to package. |
| 63 | ok_msg "start copy extra files to package" | 106 | ok_msg "start copy extra files to package" |
-
请 注册 或 登录 后发表评论