|
|
- #!/bin/sh
- # fetch_source.sh
- # This script for fetch source and packages.
- # @version 170227:1
- # @author zhangxuhong <zhangxuhong@xitu.io>
- #
-
- # [config]
- echo "-[config]-"
-
- # ----------------------------[manual config here]------------------------------
-
- # REPO_SRC=/data/repo/collection_set_api
-
- go_packages=(
- "github.com/astaxie/beego"
- "github.com/garyburd/redigo/redis"
- )
- #
- # http_proxy="http://localhost:8123"
-
- # ------------------------------------------------------------------------------
-
- # init env
-
- # $GOBIN
- export GOBIN="${REPO_SRC}/bin"
- echo -e "\033[34mGOBIN set to: ${GOBIN}\033[0m"
-
- # $GOPATH
- export GOPATH="${REPO_SRC}"
- echo -e "\033[34mGOPATH set to: ${GOPATH}\033[0m"
-
-
- # print package list
-
- echo "package list:"
- for pkg in ${go_packages[*]};
- do
- echo -e "\033[34m${pkg}\033[0m";
- done
- echo ""
-
- if [ "$http_proxy" != "" ]; then
- echo "http_proxy set to:"
- echo -e "\033[34m${http_proxy}\033[0m";
- echo "http_proxy location info:"
- proxyLocation=`http_proxy=${http_proxy} curl -s ip.gs`
- echo -e "\033[34m${proxyLocation}\033[0m";
- fi
-
- echo ""
- sleep 1
-
-
- # [fetch]
- echo "-[fetch package]-"
- for pkg in ${go_packages[*]};
- do
- if [ "$http_proxy" == "" ]; then
- echo "go get ${pkg}";
- go get $pkg;
- else
- echo "http_proxy=${http_proxy} go get ${pkg}";
- http_proxy=${http_proxy} go get $pkg;
- fi
- done
-
-
-
- echo "done."
|