swh:1:snp:8a1bf80ec89c62a71cdcaaf0c2f9145695a5340a
Raw File
Tip revision: 05b564a39413a9debafb24420de87febf34fa013 authored by Gyu-Ho Lee on 30 December 2015, 21:41:16 UTC
*: bump to v2.2.3
Tip revision: 05b564a
build-aci
#!/usr/bin/env bash

BINARYDIR=${BINARYDIR:-bin}
BUILDDIR=${BUILDDIR:-bin}

# A non-installed actool can be used, for example:
# ACTOOL=../../appc/spec/bin/actool
ACTOOL=${ACTOOL:-actool}

IMAGEDIR=${IMAGEDIR:-$BUILDDIR/image-aci}

VERSION=$1

if ! command -v $ACTOOL >/dev/null; then
    echo "actool ($ACTOOL) is not executable"
    exit 1
fi

if [ ! -x $BINARYDIR/etcd ] ; then
    echo "$BINARYDIR/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 $BINARYDIR/etcd $BINARYDIR/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.5.1",
    "acKind": "ImageManifest",
    "name": "coreos.com/etcd",
    "labels": [
        {"name": "os", "value": "linux"},
        {"name": "arch", "value": "amd64"},
        {"name": "version", "value": "${VERSION}"}
    ],
    "app": {
        "environment": [
             {
                    "name": "ETCD_DATA_DIR",
                    "value": "/data-dir"
             }
        ],
        "exec": [
             "/etcd"
        ],
        "user": "0",
        "group": "0",
        "mountPoints": [
             {
                    "name": "data-dir",
                    "path": "/data-dir"
             }
        ],
        "ports": [
            {
                "name": "legacy-client",
                "port": 4001,
                "protocol": "tcp"
            },
            {
                "name": "client",
                "port": 2379,
                "protocol": "tcp"
            },
            {
                "name": "legacy-peer",
                "port": 7001,
                "protocol": "tcp"
            },
            {
                "name": "peer",
                "port": 2380,
                "protocol": "tcp"
            }
        ]
    }
}
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 $BUILDDIR/etcd-${1}-linux-amd64.aci
back to top