1
0
mirror of https://github.com/rancher/os.git synced 2025-09-18 08:06:48 +00:00

More build script enhancements

This commit is contained in:
Darren Shepherd
2016-05-08 10:35:48 -07:00
parent 1d92167143
commit dd7b2554e7
8 changed files with 23 additions and 17 deletions

View File

@@ -30,15 +30,15 @@ RUN apt-get update && \
ENV DAPPER_DOCKER_SOCKET true
ENV DAPPER_SOURCE /go/src/github.com/rancher/os
ENV DAPPER_OUTPUT ./bin ./dist ./build/os-config.yml
ENV DAPPER_OUTPUT ./bin ./dist ./build/initrd
ENV DAPPER_RUN_ARGS --privileged
ENV SHELL /bin/bash
WORKDIR ${DAPPER_SOURCE}
########## General Configuration #####################
ARG ARCH=amd64
ARG DAPPER_HOST_ARCH=amd64
ARG HOST_ARCH=${DAPPER_HOST_ARCH}
ARG ARCH=${HOST_ARCH}
ARG OS_REPO=rancher
ARG HOSTNAME_DEFAULT=rancher
@@ -164,8 +164,6 @@ RUN source /usr/src/toolchain-env; if [ "${TOOLCHAIN}" != "" ]; then \
ENV GOARCH $ARCH
ENV DAPPER_OUTPUT ./bin ./dist ./build/os-config.yml ./build/initrd
RUN curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m` > /usr/bin/dapper && \
chmod +x /usr/bin/dapper

View File

@@ -9,6 +9,10 @@ cd $(dirname $0)/..
DO_PUSH="$1"
if [ -n "$CORE" ]; then
PREFIX=0
fi
if [ "${DO_PUSH}" == "--push" ]; then
for i in $BASE/[0-9]*; do
name="os-$(echo ${i} | cut -f2 -d-)"
@@ -17,7 +21,7 @@ if [ "${DO_PUSH}" == "--push" ]; then
docker push ${tag} || :
done
else
for i in $BASE/[0-9]*; do
for i in $BASE/$PREFIX[0-9]*; do
name="os-$(echo ${i} | cut -f2 -d-)"
tag="${OS_REPO}/${name}:${VERSION}${SUFFIX}"
echo Building ${tag}

View File

@@ -1,11 +1,14 @@
#!/bin/bash
set -e
trap "chown -R $DAPPER_UID:$DAPPER_GID ." exit
mkdir -p bin dist build
mkdir -p bin dist build/initrd
if [ -e ./scripts/$1 ]; then
./scripts/"$@"
else
"$@"
fi
EXIT=$?
chown -R $DAPPER_UID:$DAPPER_GID .
exit $EXIT

View File

@@ -12,9 +12,10 @@ echo Create initrd layout in $INITRD_DIR
rm -rf ${INITRD_DIR}
mkdir -p ${INITRD_DIR}/usr/{etc,bin,share/ros}
./scripts/template
cp -rf assets/selinux ${INITRD_DIR}/usr/etc
cp build/images.tar ${INITRD_DIR}/usr/share/ros/
cp build/os-config.yml ${INITRD_DIR}/usr/share/ros/
cp bin/ros ${INITRD_DIR}/usr/bin/
cp ${DOWNLOADS}/docker ${INITRD_DIR}/usr/bin/docker
ln -s usr/bin/ros ${INITRD_DIR}/init

View File

@@ -10,6 +10,8 @@ if [ ! -e ./bin/host_ros ]; then
fi
./template
./build-images
if [ "$HOST_ARCH" = "$ARCH" ]; then
CORE=true ./build-images
fi
./tar-images
./layout

View File

@@ -110,7 +110,6 @@ fi
if [ "$REBUILD" == "1" ]; then
cp bin/ros ${INITRD_SRC}/usr/bin/ros
cp build/os-config.yml ${INITRD_SRC}/usr/share/ros
pushd ${INITRD_SRC} >/dev/null
find . | cpio -H newc -o | gzip -1 > ${INITRD}
popd >/dev/null

View File

@@ -3,9 +3,7 @@ set -e
cd $(dirname $0)/..
mkdir -p build
IMAGES=$(bin/host_ros c images -i build/os-config.yml)
IMAGES=$(bin/host_ros c images -i build/initrd/usr/share/ros/os-config.yml)
for i in $IMAGES; do
if [ "${FORCE_PULL}" = "1" ] || ! docker inspect $i >/dev/null 2>&1; then
docker pull $i

View File

@@ -5,5 +5,6 @@ source $(dirname $0)/version
cd $(dirname $0)/..
mkdir -p build
./bin/host_ros c generate < os-config.tpl.yml > build/os-config.yml
OUTPUT=build/initrd/usr/share/ros
mkdir -p $OUTPUT
./bin/host_ros c generate < os-config.tpl.yml > $OUTPUT/os-config.yml