mirror of
https://github.com/clearlinux/rkt.git
synced 2026-09-01 02:44:56 +00:00
10beb3920d
This introduces the ability to set the default stage1 image path for `rkt run` by setting the environment variable RKT_STAGE1_IMAGE at build time (i.e when invoking ./build). The variable should be set to the fully qualified path at which rkt can find the stage1 image - for example: RKT_STAGE1_IMAGE=/usr/lib/rkt/stage1.aci ./build Rocket will use this environment variable to set the default value for the stage1-image flag. If the value is _not_ set, it will continue to use the heuristic it does today to guess the location of the stage1 image, by looking for a file called stage1.aci that is in the same directory as rkt itself.
56 lines
1.4 KiB
Python
Executable File
56 lines
1.4 KiB
Python
Executable File
#!/bin/bash -eu
|
|
|
|
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=${PWD}/gopath
|
|
|
|
eval $(go env)
|
|
|
|
echo "Building rkt (stage0)..."
|
|
go build -o ${GOBIN}/rkt \
|
|
${RKT_STAGE1_IMAGE:+-ldflags "-X main.defaultStage1Image '${RKT_STAGE1_IMAGE}'"} \
|
|
${REPO_PATH}/rkt
|
|
|
|
if [[ "$OSTYPE" == "linux-gnu" ]]; then
|
|
echo "Building network plugins..."
|
|
for d in networking/net/* networking/ipam/*; do
|
|
if [ -d $d ]; then
|
|
plugin=$(basename $d)
|
|
echo " " $plugin
|
|
go install ${REPO_PATH}/$d
|
|
fi
|
|
done
|
|
|
|
echo "Building actool..."
|
|
go build -o ${GOBIN}/actool github.com/coreos/rocket/Godeps/_workspace/src/github.com/appc/spec/actool
|
|
export ACTOOL=${GOBIN}/actool
|
|
|
|
echo "Building init (stage1)..."
|
|
go install ${REPO_PATH}/stage1/init
|
|
|
|
# symlink plugin binaries into stage1 rootfs
|
|
mkdir -p stage1/rootfs/net-plugins/bin
|
|
# make sure the bin dir doesn't have old links
|
|
rm -f stage1/rootfs/net-plugins/bin/*
|
|
for d in networking/net/* networking/ipam/*; do
|
|
if [ -d $d ]; then
|
|
plugin=$(basename $d)
|
|
ln -sf ${GOBIN}/$plugin stage1/rootfs/net-plugins/bin
|
|
fi
|
|
done
|
|
|
|
# symlink init into stage1 rootfs
|
|
mkdir -p stage1/rootfs/init/bin
|
|
ln -sf ${GOBIN}/init stage1/rootfs/init/bin
|
|
|
|
echo "Building rootfs (stage1)..."
|
|
make -C stage1/rootfs
|
|
fi
|