package-installer 2.2 KB

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