build-aci 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 --to-dir $BINARYDIR/etcd $BINARYDIR/etcdctl /
  34. acbuild --debug copy README.md /README.md
  35. acbuild --debug copy etcdctl/README.md /README-etcdctl.md
  36. acbuild --debug copy etcdctl/READMEv2.md /READMEv2-etcdctl.md
  37. acbuild --debug copy --to-dir Documentation /
  38. acbuild --debug environment add ETCD_DATA_DIR /data-dir
  39. acbuild --debug label add version "$VERSION"
  40. acbuild --debug set-exec -- /etcd
  41. acbuild --debug mount add data-dir /data-dir
  42. acbuild --debug port add client tcp 2379
  43. acbuild --debug port add peer tcp 2380
  44. acbuild --debug copy "$TMPHOSTS" /etc/hosts
  45. acbuild --debug write --overwrite $BUILDDIR/etcd-${1}-linux-amd64.aci