layout-initrd 2.0 KB

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