package-installer 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. echo Downloading dapper
  20. curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m|sed 's/v7l//'` > .dapper.tmp
  21. chmod +x .dapper.tmp
  22. ./.dapper.tmp -v
  23. mv .dapper.tmp .dapper
  24. ./.dapper
  25. popd
  26. # TODO maybe extract the creation of the syslinux cfg files
  27. DIST=$(pwd)/dist
  28. echo "mkdir -p ${DIST}/boot/isolinux/"
  29. mkdir -p ${DIST}/boot/isolinux/
  30. cat scripts/isolinux.cfg | envsubst > ${DIST}/boot/isolinux/isolinux.cfg
  31. cat scripts/isolinux_label.cfg | LABEL=${VERSION} envsubst > ${DIST}/boot/linux-current.cfg
  32. #cat scripts/isolinux_label.cfg | LABEL=debug APPEND="rancher.debug=true" envsubst > ${DIST}/boot/linux-previous.cfg
  33. cat scripts/global.cfg | LABEL=${VERSION} envsubst > ${DIST}/boot/global.cfg
  34. mkdir -p ./scripts/installer/build/boot
  35. cp ./bin/ros ./scripts/installer/build
  36. trap "rm -rf ./scripts/installer/build" EXIT
  37. # installer base image - can be included in iso
  38. # TODO: fix the fullinstaller Dockerfile to use the ${VERSION}${SUFFIX}
  39. docker build \
  40. -t ${OS_REPO}/os-installer \
  41. --build-arg VERSION=${VERSION} \
  42. --build-arg KERNEL_VERSION=${KERNEL_VERSION} \
  43. -f $BASEDOCKERFILE \
  44. ./scripts/installer
  45. docker save -o ${ARTIFACTS}/installer.tar ${OS_REPO}/os-installer
  46. cp $DOCKERFILE ${ARTIFACTS}/
  47. cp ${ARTIFACTS}/${INITRD} ./scripts/installer/build/boot
  48. cp ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION} ./scripts/installer/build/boot
  49. cp -r ${DIST}/boot/* ./scripts/installer/build/boot
  50. cp $DOCKERFILE ./scripts/installer/build/Dockerfile
  51. # Full installer image with initrd - used for pulling from network
  52. docker build \
  53. -t ${OS_REPO}/os:${VERSION}${SUFFIX} \
  54. ./scripts/installer/build
  55. docker save -o ${ARTIFACTS}/fullinstaller.tar ${OS_REPO}/os:${VERSION}${SUFFIX}
  56. echo ${OS_REPO}/os:${VERSION}${SUFFIX} >> dist/images
  57. echo Built ${OS_REPO}/os:${VERSION}${SUFFIX}