#!/bin/sh -e VER=$1 function build { proj=${1} ver=${2} if [ ! -d ${proj} ]; then git clone https://github.com/coreos/${proj} fi cd ${proj} git checkout master git fetch --all git reset --hard origin/master git checkout $ver ./build cd - } function package { target=${1} ccdir="${proj}/bin/${GOOS}_${GOARCH}" if [ -d ${ccdir} ]; then cp ${ccdir}/etcdctl ${target} cp ${ccdir}/etcd ${target} else cp ${proj}/bin/etcd ${target} cp ${proj}/bin/etcdctl ${target} fi cp etcd/README.md ${target}/README.md cp etcd/etcdctl/README.md ${target}/README-etcdctl.md cp -R etcd/Documentation/0.5 ${target}/Documentation } mkdir release cd release for i in darwin windows linux; do export GOOS=${i} export GOARCH="amd64" build etcd ${VER} TARGET="etcd-${VER}-${GOOS}-${GOARCH}" mkdir ${TARGET} package ${TARGET} if [ ${GOOS} == "linux" ]; then tar cvvfz ${TARGET}.tar.gz ${TARGET} else zip -r ${TARGET}.zip ${TARGET} fi done