-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
executable file
·44 lines (35 loc) · 1.11 KB
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash -e
ORG_PATH="github.com/coreos"
REPO_PATH="${ORG_PATH}/rocket"
if [ ! -h gopath/src/${REPO_PATH} ]; then
mkdir -p gopath/src/${ORG_PATH}
ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
fi
export GOBIN=${PWD}/bin
export GOPATH=${GOPATH}:${PWD}/gopath
eval $(go env)
if [[ "$OSTYPE" == "linux-gnu" ]]; then
echo "Building init (stage1)..."
go build -o $GOBIN/init ${REPO_PATH}/stage1
S1BINS=${PWD}/stage0
S1INIT=${S1BINS}/stage1_init
if [ $GOBIN/init -nt $S1INIT/bin.go ]; then
echo "Packaging init (stage1)..."
TMP=$(mktemp -d -t rocket-XXXXXX)
[ -d $S1INIT ] || mkdir -p $S1INIT
cp $GOBIN/init $TMP/s1init
go-bindata -o $S1INIT/bin.go -pkg="stage1_init" -prefix=$TMP $TMP
fi
S1ROOTFS=${S1BINS}/stage1_rootfs
if [ stage1/mkrootfs.sh -nt $S1ROOTFS/bin.go ]; then
echo "Generating and packaging rootfs (stage1)..."
[ -d "${S1ROOTFS}" ] || mkdir -p "${S1ROOTFS}"
pushd stage1
OUTPUT=$S1ROOTFS/bin.go ./mkrootfs.sh
popd
fi
fi
echo "Building rkt (stage0)..."
go build -o $GOBIN/rkt ${REPO_PATH}/rkt
echo "Building metadatasvc..."
go build -o $GOBIN/metadatasvc ${REPO_PATH}/metadatasvc