1
0
mirror of https://github.com/rancher/os.git synced 2025-08-31 22:32:14 +00:00

More build script changes

This commit is contained in:
Darren Shepherd
2016-05-31 21:11:03 -07:00
parent a14846152b
commit 5bf4d2c117
9 changed files with 43 additions and 16 deletions

View File

@@ -14,4 +14,5 @@ fi
OUTPUT=${OUTPUT:-bin/ros}
echo Building $OUTPUT
go build -tags netgo -installsuffix netgo -ldflags "-X github.com/rancher/os/config.VERSION=${VERSION} -linkmode external -extldflags -static" -o ${OUTPUT}
go build -tags "selinux cgo daemon netgo" -installsuffix netgo -ldflags "-X github.com/rancher/os/config.VERSION=${VERSION} -linkmode external -extldflags -static" -o ${OUTPUT}
strip --strip-all ${OUTPUT}

5
scripts/hash-initrd Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
cd $(dirname $0)/../build/initrd
md5sum $(find -type f | sort -u ) | md5sum - | awk '{print $1}' > .id

View File

@@ -24,7 +24,19 @@ ln -s usr/sbin ${INITRD_DIR}/sbin
if [ -e ${DOWNLOADS}/kernel.tar.gz ]; then
tar xf ${DOWNLOADS}/kernel.tar.gz -C ${INITRD_DIR}/usr/ lib/
mkdir -p ${BUILD}/kernel
tar xf ${DOWNLOADS}/kernel.tar.gz -C ${BUILD}/kernel
if [ -e ${BUILD}/kernel/boot/vmlinuz-* ]; then
mkdir -p dist/artifacts
cp ${BUILD}/kernel/boot/vmlinuz-* dist/artifacts/vmlinuz
fi
if [ -d ${BUILD}/kernel/lib ]; then
rm -rf ${INITRD_DIR}/usr/lib
cp -rf ${BUILD}/kernel/lib ${INITRD_DIR}/usr/
depmod -b ${INITRD_DIR}/usr $(basename ${INITRD_DIR}/usr/lib/modules/*)
fi
fi
if [ -e ${DOWNLOADS}/policy.29 ]; then
@@ -43,11 +55,4 @@ docker export ${DFS_ARCH} | tar xf - -C ${INITRD_DIR} --exclude=usr/bin/dockerla
--exclude=usr/libexec/git-core \
usr
tar xf ${DOWNLOADS}/kernel.tar.gz -C ${BUILD} boot/
if [ -e ${BUILD}/boot/vmlinuz-* ]; then
mkdir -p dist/artifacts
cp ${BUILD}/boot/vmlinuz-* dist/artifacts/vmlinuz
fi
cat /proc/sys/kernel/random/uuid > ${INITRD_DIR}/.id
./scripts/hash-initrd

View File

@@ -111,6 +111,7 @@ fi
if [ "$REBUILD" == "1" ] || [ ! -e ${INITRD} ]; then
cp bin/ros ${INITRD_SRC}/usr/bin/ros
./scripts/hash-initrd
pushd ${INITRD_SRC} >/dev/null
find . | cpio -H newc -o | gzip -1 > ${INITRD}
popd >/dev/null

View File

@@ -8,4 +8,7 @@ echo Running tests
PACKAGES=". $(find -name '*.go' | xargs -I{} dirname {} | cut -f2 -d/ | sort -u | grep -Ev '(^\.$|.git|.trash-cache|vendor|bin)' | sed -e 's!^!./!' -e 's!$!/...!')"
go test -race -cover -tags=test ${PACKAGES}
if [ "$ARCH" = "amd64" ]; then
RACE="-race"
fi
go test $RACE -cover -tags=test ${PACKAGES}