layout-initrd 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. echo Create initrd layout in $INITRD_DIR
  2. rm -rf ${INITRD_DIR}
  3. mkdir -p ${INITRD_DIR}/usr/{etc,lib,bin,share/ros}
  4. ./scripts/template
  5. cp -rf assets/selinux ${INITRD_DIR}/usr/etc
  6. cp build/images.tar ${INITRD_DIR}/usr/share/ros/
  7. cp bin/ros ${INITRD_DIR}/usr/bin/
  8. ln -s usr/bin/ros ${INITRD_DIR}/init
  9. ln -s bin ${INITRD_DIR}/usr/sbin
  10. ln -s usr/sbin ${INITRD_DIR}/sbin
  11. curl -SL ${!SYSTEM_DOCKER_URL} | tar --strip-components=1 -xzvf - -C ${INITRD_DIR}/usr/bin/
  12. # we have diabled the user-proxy so we get rid of system-docker-proxy
  13. rm -f ${INITRD_DIR}/usr/bin/system-docker-proxy
  14. cat <<HERE > ${INITRD_DIR}/usr/share/ros/os-release
  15. NAME="RancherOS"
  16. VERSION=${VERSION}
  17. ID=rancheros
  18. ID_LIKE=
  19. VERSION_ID=${VERSION}
  20. PRETTY_NAME="RancherOS ${VERSION}"
  21. HOME_URL="http://rancher.com/rancher-os/"
  22. SUPPORT_URL="https://forums.rancher.com/c/rancher-os"
  23. BUG_REPORT_URL="https://github.com/rancher/os/issues"
  24. BUILD_ID=
  25. HERE
  26. # cache os-services yml file
  27. if [ -e ".make-vmware" ]; then
  28. SERVICE_URL=${OS_SERVICES_REPO}/${REPO_VERSION}
  29. SERVICE_INDEX_URL="${SERVICE_URL}/index.yml"
  30. SERVICE_OPEN_VMTOOLS_URL="${SERVICE_URL}/o/open-vm-tools.yml"
  31. SERVICE_INDEX_URL_MD5=$(echo -n ${SERVICE_INDEX_URL}|md5sum|cut -d ' ' -f1)
  32. SERVICE_OPEN_VMTOOLS_URL_MD5=$(echo -n ${SERVICE_OPEN_VMTOOLS_URL}|md5sum|cut -d ' ' -f1)
  33. mkdir -p ${INITRD_DIR}/usr/share/ros/services-cache/
  34. wget -O ${INITRD_DIR}/usr/share/ros/services-cache/${SERVICE_INDEX_URL_MD5} ${SERVICE_INDEX_URL}
  35. wget -O ${INITRD_DIR}/usr/share/ros/services-cache/${SERVICE_OPEN_VMTOOLS_URL_MD5} ${SERVICE_OPEN_VMTOOLS_URL}
  36. fi
  37. # TODO: usr/lib dir is overwritten by the kernel modules and firmware
  38. ln -s ${INITRD_DIR}/usr/share/ros/os-release ${INITRD_DIR}/usr/lib/
  39. ln -s ${INITRD_DIR}/usr/share/ros/os-release ${INITRD_DIR}/usr/etc/
  40. # Support upgrades from old persistent consoles that bind mount these
  41. touch ${INITRD_DIR}/usr/bin/docker-containerd
  42. touch ${INITRD_DIR}/usr/bin/docker-containerd-shim
  43. touch ${INITRD_DIR}/usr/bin/docker
  44. if [ -e ${DOWNLOADS}/policy.29 ]; then
  45. mkdir -p ${INITRD_DIR}/usr/etc/selinux/ros/policy/
  46. cp ${DOWNLOADS}/policy.29 ${INITRD_DIR}/usr/etc/selinux/ros/policy/
  47. fi
  48. # make rancher/os-initrd image
  49. cat <<HERE > ${INITRD_DIR}/../Dockerfile.initrd
  50. FROM scratch
  51. COPY initrd/* /
  52. HERE
  53. name="os-initrd"
  54. tag="${OS_REPO}/${name}:${VERSION}${SUFFIX}"
  55. pushd .
  56. cd ${INITRD_DIR}/..
  57. docker build -t ${OS_REPO}/${name} -f Dockerfile.initrd .
  58. docker tag rancher/${name} ${tag}
  59. popd