package-installer 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. mkdir -p ./scripts/installer/build/boot
  30. cp ./bin/ros ./scripts/installer/build
  31. trap "rm -rf ./scripts/installer/build" EXIT
  32. # installer base image - can be included in iso
  33. # TODO: fix the fullinstaller Dockerfile to use the ${VERSION}${SUFFIX}
  34. docker build \
  35. -t ${OS_REPO}/os-installer \
  36. --build-arg VERSION=${VERSION} \
  37. --build-arg KERNEL_VERSION=${KERNEL_VERSION} \
  38. -f $BASEDOCKERFILE \
  39. ./scripts/installer
  40. docker save -o ${ARTIFACTS}/installer.tar ${OS_REPO}/os-installer
  41. cp $DOCKERFILE ${ARTIFACTS}/
  42. cp ${ARTIFACTS}/${INITRD} ./scripts/installer/build/boot
  43. cp ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION} ./scripts/installer/build/boot
  44. cp -r ${DIST}/boot/* ./scripts/installer/build/boot
  45. cp $DOCKERFILE ./scripts/installer/build/Dockerfile
  46. # Full installer image with initrd - used for pulling from network
  47. docker build \
  48. -t ${OS_REPO}/os:${VERSION}${SUFFIX} \
  49. ./scripts/installer/build
  50. docker save -o ${ARTIFACTS}/fullinstaller.tar ${OS_REPO}/os:${VERSION}${SUFFIX}
  51. echo ${OS_REPO}/os:${VERSION}${SUFFIX} >> dist/images
  52. echo Built ${OS_REPO}/os:${VERSION}${SUFFIX}