build-aci 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/bash
  2. # A non-installed actool can be used, for example:
  3. # ACTOOL=../../appc/spec/bin/actool
  4. ACTOOL=${ACTOOL:-actool}
  5. IMAGEDIR=${IMAGEDIR:-bin/image-aci}
  6. VERSION=$1
  7. if [ ! -x "$ACTOOL" ] ; then
  8. echo "actool ($ACTOOL) is not executable"
  9. exit 1
  10. fi
  11. if [ ! -x bin/etcd ] ; then
  12. echo "bin/etcd not found. Is it compiled?"
  13. exit 1
  14. fi
  15. if [ -z "$VERSION" ] ; then
  16. echo "Usage: scripts/build-aci VERSION"
  17. exit 1
  18. fi
  19. mkdir -p $IMAGEDIR/rootfs
  20. if [ ! -d $IMAGEDIR/rootfs -o ! -x $IMAGEDIR/rootfs ]; then
  21. echo "$IMAGEDIR/rootfs is not a writeable directory"
  22. exit 1
  23. fi
  24. if [ -n "$(ls -A $IMAGEDIR/rootfs)" ]; then
  25. echo "$IMAGEDIR/rootfs is not empty"
  26. exit 1
  27. fi
  28. cp bin/etcd bin/etcdctl $IMAGEDIR/rootfs/
  29. cp README.md $IMAGEDIR/rootfs/
  30. cp etcdctl/README.md $IMAGEDIR/rootfs/README-etcdctl.md
  31. cp -r Documentation $IMAGEDIR/rootfs/
  32. cat <<DF > $IMAGEDIR/manifest
  33. {
  34. "acVersion": "0.1.1",
  35. "acKind": "ImageManifest",
  36. "name": "coreos.com/etcd",
  37. "labels": [
  38. {"name": "os", "value": "linux"},
  39. {"name": "arch", "value": "amd64"},
  40. {"name": "version", "value": "${VERSION}"}
  41. ],
  42. "app": {
  43. "exec": [
  44. "/etcd"
  45. ],
  46. "user": "0",
  47. "group": "0"
  48. }
  49. }
  50. DF
  51. mkdir -p $IMAGEDIR/rootfs/etc/
  52. cat <<DF > $IMAGEDIR/rootfs/etc/hosts
  53. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
  54. DF
  55. $ACTOOL build -overwrite=true $IMAGEDIR bin/etcd-${1}-linux-amd64.aci