package-installer 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 \
  9. [[ "${ARCH}" != "amd64" ]] || \
  10. [ ! -f ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION} ] || \
  11. [ ! -f ${ARTIFACTS}/${INITRD} ]; \
  12. then
  13. echo "Skipping package-installer due to ARM/ARM64 build: ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION} or ${ARTIFACTS}/${INITRD} not found"
  14. exit 0
  15. fi
  16. # build kexec
  17. pushd .
  18. cd scripts/installer/kexec
  19. dapper
  20. popd
  21. # TODO maybe extract the creation of the syslinux cfg files
  22. DIST=$(pwd)/dist
  23. echo "mkdir -p ${DIST}/boot/isolinux/"
  24. mkdir -p ${DIST}/boot/isolinux/
  25. cat scripts/isolinux.cfg | envsubst > ${DIST}/boot/isolinux/isolinux.cfg
  26. cat scripts/isolinux_label.cfg | LABEL=${VERSION} envsubst > ${DIST}/boot/linux-current.cfg
  27. #cat scripts/isolinux_label.cfg | LABEL=debug APPEND="rancher.debug=true" envsubst > ${DIST}/boot/linux-previous.cfg
  28. cat scripts/global.cfg | LABEL=${VERSION} envsubst > ${DIST}/boot/global.cfg
  29. cp scripts/rancher.png ${DIST}/boot/
  30. mkdir -p ./scripts/installer/build/boot
  31. cp ./bin/ros ./scripts/installer/build
  32. trap "rm -rf ./scripts/installer/build" EXIT
  33. # installer base image - can be included in iso
  34. # TODO: fix the fullinstaller Dockerfile to use the ${VERSION}${SUFFIX}
  35. docker build \
  36. -t ${OS_REPO}/os-installer \
  37. --build-arg VERSION=${VERSION} \
  38. --build-arg KERNEL_VERSION=${KERNEL_VERSION} \
  39. -f $BASEDOCKERFILE \
  40. ./scripts/installer
  41. docker save -o ${ARTIFACTS}/installer.tar ${OS_REPO}/os-installer
  42. cp $DOCKERFILE ${ARTIFACTS}/
  43. cp ${ARTIFACTS}/${INITRD} ./scripts/installer/build/boot
  44. cp ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION} ./scripts/installer/build/boot
  45. cp -r ${DIST}/boot/* ./scripts/installer/build/boot
  46. cp $DOCKERFILE ./scripts/installer/build/Dockerfile
  47. # Full installer image with initrd - used for pulling from network
  48. docker build \
  49. -t ${OS_REPO}/os \
  50. ./scripts/installer/build
  51. docker tag ${OS_REPO}/os ${OS_REPO}/os:${VERSION}${SUFFIX}
  52. docker save -o ${ARTIFACTS}/fullinstaller.tar ${OS_REPO}/os:${VERSION}${SUFFIX}
  53. echo ${OS_REPO}/os:${VERSION}${SUFFIX} >> dist/images
  54. echo Built ${OS_REPO}/os:${VERSION}${SUFFIX}