install-binaries.sh 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #!/bin/sh
  2. set -e
  3. set -x
  4. . $(dirname "$0")/binaries-commits
  5. RM_GOPATH=0
  6. TMP_GOPATH=${TMP_GOPATH:-""}
  7. if [ -z "$TMP_GOPATH" ]; then
  8. export GOPATH="$(mktemp -d)"
  9. RM_GOPATH=1
  10. else
  11. export GOPATH="$TMP_GOPATH"
  12. fi
  13. # Do not build with ambient capabilities support
  14. RUNC_BUILDTAGS="${RUNC_BUILDTAGS:-"seccomp apparmor selinux"}"
  15. install_runc() {
  16. echo "Install runc version $RUNC_COMMIT"
  17. git clone https://github.com/docker/runc.git "$GOPATH/src/github.com/opencontainers/runc"
  18. cd "$GOPATH/src/github.com/opencontainers/runc"
  19. git checkout -q "$RUNC_COMMIT"
  20. make BUILDTAGS="$RUNC_BUILDTAGS" $1
  21. cp runc /usr/local/bin/docker-runc
  22. }
  23. install_containerd() {
  24. echo "Install containerd version $CONTAINERD_COMMIT"
  25. git clone https://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd"
  26. cd "$GOPATH/src/github.com/docker/containerd"
  27. git checkout -q "$CONTAINERD_COMMIT"
  28. make $1
  29. cp bin/containerd /usr/local/bin/docker-containerd
  30. cp bin/containerd-shim /usr/local/bin/docker-containerd-shim
  31. cp bin/ctr /usr/local/bin/docker-containerd-ctr
  32. }
  33. install_proxy() {
  34. echo "Install docker-proxy version $LIBNETWORK_COMMIT"
  35. git clone https://github.com/docker/libnetwork.git "$GOPATH/src/github.com/docker/libnetwork"
  36. cd "$GOPATH/src/github.com/docker/libnetwork"
  37. git checkout -q "$LIBNETWORK_COMMIT"
  38. go build -ldflags="$PROXY_LDFLAGS" -o /usr/local/bin/docker-proxy github.com/docker/libnetwork/cmd/proxy
  39. }
  40. install_bindata() {
  41. echo "Install go-bindata version $BINDATA_COMMIT"
  42. git clone https://github.com/jteeuwen/go-bindata "$GOPATH/src/github.com/jteeuwen/go-bindata"
  43. cd $GOPATH/src/github.com/jteeuwen/go-bindata
  44. git checkout -q "$BINDATA_COMMIT"
  45. go build -o /usr/local/bin/go-bindata github.com/jteeuwen/go-bindata/go-bindata
  46. }
  47. for prog in "$@"
  48. do
  49. case $prog in
  50. tomlv)
  51. echo "Install tomlv version $TOMLV_COMMIT"
  52. git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml"
  53. cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT"
  54. go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv
  55. ;;
  56. runc)
  57. install_runc static
  58. ;;
  59. runc-dynamic)
  60. install_runc
  61. ;;
  62. containerd)
  63. install_containerd static
  64. ;;
  65. containerd-dynamic)
  66. install_containerd
  67. ;;
  68. tini)
  69. echo "Install tini version $TINI_COMMIT"
  70. git clone https://github.com/krallin/tini.git "$GOPATH/tini"
  71. cd "$GOPATH/tini"
  72. git checkout -q "$TINI_COMMIT"
  73. cmake .
  74. make tini-static
  75. cp tini-static /usr/local/bin/docker-init
  76. ;;
  77. proxy)
  78. export CGO_ENABLED=0
  79. install_proxy
  80. ;;
  81. proxy-dynamic)
  82. PROXY_LDFLAGS="-linkmode=external" install_proxy
  83. ;;
  84. vndr)
  85. echo "Install vndr version $VNDR_COMMIT"
  86. git clone https://github.com/LK4D4/vndr.git "$GOPATH/src/github.com/LK4D4/vndr"
  87. cd "$GOPATH/src/github.com/LK4D4/vndr"
  88. git checkout -q "$VNDR_COMMIT"
  89. go build -v -o /usr/local/bin/vndr .
  90. ;;
  91. bindata)
  92. install_bindata
  93. ;;
  94. *)
  95. echo echo "Usage: $0 [tomlv|runc|containerd|tini|proxy]"
  96. exit 1
  97. esac
  98. done
  99. if [ $RM_GOPATH -eq 1 ]; then
  100. rm -rf "$GOPATH"
  101. fi