package-installer 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. set -e
  3. cd $(dirname $0)/..
  4. source ./scripts/version
  5. BASEDOCKERFILE=./scripts/installer/BaseDockerfile.${ARCH}
  6. DOCKERFILE=./scripts/installer/Dockerfile.${ARCH}
  7. ARTIFACTS=./dist/artifacts
  8. if [ ! -f $DOCKERFILE ] || [ ! -f ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION} ] || [ ! -f ${ARTIFACTS}/${INITRD} ]; then
  9. echo "Skipping package-installer due to ARM build: ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION} or ${ARTIFACTS}/${INITRD} not found"
  10. exit 0
  11. fi
  12. # TODO maybe extract the creation of the syslinux cfg files
  13. DIST=$(pwd)/dist
  14. echo "mkdir -p ${DIST}/boot/isolinux/"
  15. mkdir -p ${DIST}/boot/isolinux/
  16. cat scripts/isolinux.cfg | envsubst > ${DIST}/boot/isolinux/isolinux.cfg
  17. cat scripts/isolinux_label.cfg | LABEL=${VERSION} envsubst > ${DIST}/boot/linux-current.cfg
  18. #cat scripts/isolinux_label.cfg | LABEL=debug APPEND="rancher.debug=true" envsubst > ${DIST}/boot/linux-previous.cfg
  19. cat scripts/global.cfg | LABEL=${VERSION} envsubst > ${DIST}/boot/global.cfg
  20. mkdir -p ./scripts/installer/build/boot
  21. cp ./bin/ros ./scripts/installer/build
  22. trap "rm -rf ./scripts/installer/build" EXIT
  23. # installer base image - can be included in iso
  24. # TODO: fix the fullinstaller Dockerfile to use the ${VERSION}${SUFFIX}
  25. docker build \
  26. -t ${OS_REPO}/os-installer \
  27. --build-arg VERSION=${VERSION} \
  28. --build-arg KERNEL_VERSION=${KERNEL_VERSION} \
  29. -f $BASEDOCKERFILE \
  30. ./scripts/installer
  31. docker save -o ${ARTIFACTS}/installer.tar ${OS_REPO}/os-installer
  32. cp $DOCKERFILE ${ARTIFACTS}/
  33. cp ${ARTIFACTS}/${INITRD} ./scripts/installer/build/boot
  34. cp ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION} ./scripts/installer/build/boot
  35. cp -r ${DIST}/boot/* ./scripts/installer/build/boot
  36. cp $DOCKERFILE ./scripts/installer/build/Dockerfile
  37. # Full installer image with initrd - used for pulling from network
  38. docker build \
  39. -t ${OS_REPO}/os:${VERSION}${SUFFIX} \
  40. ./scripts/installer/build
  41. docker save -o ${ARTIFACTS}/fullinstaller.tar ${OS_REPO}/os:${VERSION}${SUFFIX}
  42. echo ${OS_REPO}/os:${VERSION}${SUFFIX} >> dist/images
  43. echo Built ${OS_REPO}/os:${VERSION}${SUFFIX}