| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #!/bin/bash
- # A non-installed actool can be used, for example:
- # ACTOOL=../../appc/spec/bin/actool
- ACTOOL=${ACTOOL:-actool}
- IMAGEDIR=${IMAGEDIR:-bin/image-aci}
- VERSION=$1
- if [ ! -x "$ACTOOL" ] ; then
- echo "actool ($ACTOOL) is not executable"
- exit 1
- fi
- if [ ! -x bin/etcd ] ; then
- echo "bin/etcd not found. Is it compiled?"
- exit 1
- fi
- if [ -z "$VERSION" ] ; then
- echo "Usage: scripts/build-aci VERSION"
- exit 1
- fi
- mkdir -p $IMAGEDIR/rootfs
- if [ ! -d $IMAGEDIR/rootfs -o ! -x $IMAGEDIR/rootfs ]; then
- echo "$IMAGEDIR/rootfs is not a writeable directory"
- exit 1
- fi
- if [ -n "$(ls -A $IMAGEDIR/rootfs)" ]; then
- echo "$IMAGEDIR/rootfs is not empty"
- exit 1
- fi
- cp bin/etcd bin/etcdctl $IMAGEDIR/rootfs/
- cp README.md $IMAGEDIR/rootfs/
- cp etcdctl/README.md $IMAGEDIR/rootfs/README-etcdctl.md
- cp -r Documentation $IMAGEDIR/rootfs/
- cat <<DF > $IMAGEDIR/manifest
- {
- "acVersion": "0.1.1",
- "acKind": "ImageManifest",
- "name": "coreos.com/etcd",
- "labels": [
- {"name": "os", "value": "linux"},
- {"name": "arch", "value": "amd64"},
- {"name": "version", "value": "${VERSION}"}
- ],
- "app": {
- "exec": [
- "/etcd"
- ],
- "user": "0",
- "group": "0"
- }
- }
- DF
- mkdir -p $IMAGEDIR/rootfs/etc/
- cat <<DF > $IMAGEDIR/rootfs/etc/hosts
- 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
- DF
- $ACTOOL build -overwrite=true $IMAGEDIR bin/etcd-${1}-linux-amd64.aci
|