1
0
mirror of https://github.com/rancher/os.git synced 2025-06-28 15:56:58 +00:00
os/scripts/package-installer

53 lines
1.9 KiB
Plaintext
Raw Normal View History

2016-06-07 06:00:15 +00:00
#!/bin/bash
set -e
cd $(dirname $0)/..
source ./scripts/version
BASEDOCKERFILE=./scripts/installer/BaseDockerfile.${ARCH}
2016-06-07 06:00:15 +00:00
DOCKERFILE=./scripts/installer/Dockerfile.${ARCH}
if [ ! -f $DOCKERFILE ] || [ ! -f dist/artifacts/vmlinuz-${KERNEL_VERSION} ] || [ ! -f ${INITRD} ]; then
echo "ERROR: ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION} or ${INITRD} not found"
exit 1
2016-06-07 06:00:15 +00:00
fi
# TODO maybe extract the creation of the syslinux cfg files
DIST=$(pwd)/dist
echo "mkdir -p ${DIST}/boot/isolinux/"
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
mkdir -p ./scripts/installer/build/boot
cp ./bin/ros ./scripts/installer/build
2016-06-07 06:00:15 +00:00
trap "rm -rf ./scripts/installer/build" EXIT
# 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 \
--build-arg VERSION=${VERSION} \
--build-arg KERNEL_VERSION=${KERNEL_VERSION} \
-f $BASEDOCKERFILE \
./scripts/installer
docker save -o dist/artifacts/installer.tar ${OS_REPO}/os-installer
cp $DOCKERFILE dist/artifacts/
cp ${INITRD} ./scripts/installer/build/boot
cp ./dist/artifacts/vmlinuz-${KERNEL_VERSION} ./scripts/installer/build/boot
cp -r ${DIST}/boot/* ./scripts/installer/build/boot
cp $DOCKERFILE ./scripts/installer/build/Dockerfile
# Full installer image with initrd - used for pulling from network
docker build \
-t ${OS_REPO}/os:${VERSION}${SUFFIX} \
./scripts/installer/build
docker save -o dist/artifacts/fullinstaller.tar ${OS_REPO}/os:${VERSION}${SUFFIX}
echo ${OS_REPO}/os:${VERSION}${SUFFIX} >> dist/images
2016-06-07 06:00:15 +00:00
echo Built ${OS_REPO}/os:${VERSION}${SUFFIX}