winlin

add github script

  1 +#!/bin/bash
  2 +
  3 +echo "submit code to github.com"
  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 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
  30 +
  31 +sync_push "Github"
  32 +
  33 +exit 0