build-aci 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/usr/bin/env bash
  2. set -e
  3. BINARYDIR=${BINARYDIR:-bin}
  4. BUILDDIR=${BUILDDIR:-bin}
  5. # A non-installed acbuild can be used, for example:
  6. # ACBUILD=../../appc/acbuild/bin/acbuild
  7. ACBUILD=${ACBUILD:-acbuild}
  8. VERSION=$1
  9. if ! command -v $ACBUILD >/dev/null; then
  10. echo "acbuild ($ACBUILD) is not executable"
  11. exit 1
  12. fi
  13. if [ ! -x $BINARYDIR/etcd ] ; then
  14. echo "$BINARYDIR/etcd not found. Is it compiled?"
  15. exit 1
  16. fi
  17. if [ -z "$VERSION" ] ; then
  18. echo "Usage: scripts/build-aci VERSION"
  19. exit 1
  20. fi
  21. acbuild --debug begin
  22. TMPHOSTS="$(mktemp)"
  23. acbuildEnd() {
  24. rm "$TMPHOSTS"
  25. export EXIT=$?
  26. acbuild --debug end && exit $EXIT
  27. }
  28. trap acbuildEnd EXIT
  29. cat <<DF > $TMPHOSTS
  30. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
  31. DF
  32. acbuild --debug set-name coreos.com/etcd
  33. acbuild --debug copy $BINARYDIR/etcd /usr/local/bin/etcd
  34. acbuild --debug copy $BINARYDIR/etcdctl /usr/local/bin/etcdctl
  35. acbuild --debug copy README.md README.md
  36. acbuild --debug copy etcdctl/README.md README-etcdctl.md
  37. acbuild --debug copy etcdctl/READMEv2.md READMEv2-etcdctl.md
  38. acbuild --debug copy-to-dir Documentation .
  39. acbuild --debug environment add ETCD_DATA_DIR /var/lib/etcd
  40. acbuild --debug mount add data-dir /var/lib/etcd
  41. acbuild --debug label add version "$VERSION"
  42. acbuild --debug set-exec -- /usr/local/bin/etcd
  43. acbuild --debug port add client tcp 2379
  44. acbuild --debug port add peer tcp 2380
  45. acbuild --debug copy "$TMPHOSTS" /etc/hosts
  46. # mkdir default data-dir
  47. mkdir -p .acbuild/currentaci/rootfs/var/lib/etcd
  48. # symlinks for backward-compatibility
  49. ln -s ./usr/local/bin/etcd .acbuild/currentaci/rootfs/etcd
  50. ln -s ./usr/local/bin/etcdctl .acbuild/currentaci/rootfs/etcdctl
  51. acbuild --debug write --overwrite $BUILDDIR/etcd-${1}-linux-amd64.aci