2016-06-07 06:00:15 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
cd $(dirname $0)/..
|
|
|
|
|
|
|
|
source ./scripts/version
|
|
|
|
|
2016-12-06 03:16:18 +00:00
|
|
|
BASEDOCKERFILE=./scripts/installer/BaseDockerfile.${ARCH}
|
2016-06-07 06:00:15 +00:00
|
|
|
DOCKERFILE=./scripts/installer/Dockerfile.${ARCH}
|
|
|
|
|
2017-01-27 02:53:44 +00:00
|
|
|
if [ ! -f $DOCKERFILE ] || [ ! -f dist/artifacts/vmlinuz-${KERNEL_VERSION} ] || [ ! -f ${INITRD} ]; then
|
2017-02-01 05:24:01 +00:00
|
|
|
echo "Skipping package-installer due to ARM build: ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION} or ${INITRD} not found"
|
|
|
|
exit 0
|
2016-06-07 06:00:15 +00:00
|
|
|
fi
|
|
|
|
|
2016-12-20 12:49:34 +00:00
|
|
|
# TODO maybe extract the creation of the syslinux cfg files
|
2017-01-27 02:53:44 +00:00
|
|
|
DIST=$(pwd)/dist
|
|
|
|
echo "mkdir -p ${DIST}/boot/isolinux/"
|
2016-12-19 02:12:14 +00:00
|
|
|
mkdir -p ${DIST}/boot/isolinux/
|
|
|
|
cat scripts/isolinux.cfg | envsubst > ${DIST}/boot/isolinux/isolinux.cfg
|
|
|
|
cat scripts/isolinux_label.cfg | LABEL=${VERSION} envsubst > ${DIST}/boot/linux-current.cfg
|
|
|
|
#cat scripts/isolinux_label.cfg | LABEL=debug APPEND="rancher.debug=true" envsubst > ${DIST}/boot/linux-previous.cfg
|
|
|
|
cat scripts/global.cfg | LABEL=${VERSION} envsubst > ${DIST}/boot/global.cfg
|
|
|
|
|
|
|
|
|
2016-12-20 12:49:34 +00:00
|
|
|
mkdir -p ./scripts/installer/build/boot
|
2016-12-01 03:55:19 +00:00
|
|
|
cp ./bin/ros ./scripts/installer/build
|
2016-06-07 06:00:15 +00:00
|
|
|
trap "rm -rf ./scripts/installer/build" EXIT
|
|
|
|
|
2016-12-06 03:16:18 +00:00
|
|
|
# installer base image - can be included in iso
|
|
|
|
# TODO: fix the fullinstaller Dockerfile to use the ${VERSION}${SUFFIX}
|
|
|
|
docker build \
|
|
|
|
-t ${OS_REPO}/os-installer \
|
2016-12-19 02:12:14 +00:00
|
|
|
--build-arg VERSION=${VERSION} \
|
|
|
|
--build-arg KERNEL_VERSION=${KERNEL_VERSION} \
|
2016-12-06 03:16:18 +00:00
|
|
|
-f $BASEDOCKERFILE \
|
|
|
|
./scripts/installer
|
|
|
|
docker save -o dist/artifacts/installer.tar ${OS_REPO}/os-installer
|
2016-12-20 12:49:34 +00:00
|
|
|
cp $DOCKERFILE dist/artifacts/
|
2016-12-06 03:16:18 +00:00
|
|
|
|
2017-01-27 02:53:44 +00:00
|
|
|
cp ${INITRD} ./scripts/installer/build/boot
|
2016-12-20 12:49:34 +00:00
|
|
|
cp ./dist/artifacts/vmlinuz-${KERNEL_VERSION} ./scripts/installer/build/boot
|
|
|
|
cp -r ${DIST}/boot/* ./scripts/installer/build/boot
|
|
|
|
cp $DOCKERFILE ./scripts/installer/build/Dockerfile
|
2016-12-06 03:16:18 +00:00
|
|
|
# Full installer image with initrd - used for pulling from network
|
2016-12-04 11:27:06 +00:00
|
|
|
docker build \
|
|
|
|
-t ${OS_REPO}/os:${VERSION}${SUFFIX} \
|
2016-12-20 12:49:34 +00:00
|
|
|
./scripts/installer/build
|
2016-12-06 03:16:18 +00:00
|
|
|
|
|
|
|
docker save -o dist/artifacts/fullinstaller.tar ${OS_REPO}/os:${VERSION}${SUFFIX}
|
2016-11-24 01:35:27 +00:00
|
|
|
echo ${OS_REPO}/os:${VERSION}${SUFFIX} >> dist/images
|
2016-06-07 06:00:15 +00:00
|
|
|
echo Built ${OS_REPO}/os:${VERSION}${SUFFIX}
|