layout-initrd 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 ros ${INITRD_DIR}/usr/bin/system-docker
  13. ln -s ros ${INITRD_DIR}/usr/bin/docker-runc
  14. ln -s ../../../../usr/bin/ros ${INITRD_DIR}/usr/var/lib/cni/bin/bridge
  15. ln -s ../../../../usr/bin/ros ${INITRD_DIR}/usr/var/lib/cni/bin/host-local
  16. cat <<HERE > ${INITRD_DIR}/usr/share/ros/os-release
  17. NAME="RancherOS"
  18. VERSION=${VERSION}
  19. ID=rancheros
  20. ID_LIKE=
  21. VERSION_ID=${VERSION}
  22. PRETTY_NAME="RancherOS ${VERSION}"
  23. HOME_URL="http://rancher.com/rancher-os/"
  24. SUPPORT_URL="https://forums.rancher.com/c/rancher-os"
  25. BUG_REPORT_URL="https://github.com/rancher/os/issues"
  26. BUILD_ID=
  27. HERE
  28. # TODO: usr/lib dir is overwritten by the kernel modules and firmware
  29. ln -s ../share/ros/os-release ${INITRD_DIR}/usr/lib/
  30. # Support upgrades from old persistent consoles that bind mount these
  31. touch ${INITRD_DIR}/usr/bin/docker-containerd
  32. touch ${INITRD_DIR}/usr/bin/docker-containerd-shim
  33. touch ${INITRD_DIR}/usr/bin/docker
  34. if [ -e ${DOWNLOADS}/policy.29 ]; then
  35. mkdir -p ${INITRD_DIR}/usr/etc/selinux/ros/policy/
  36. cp ${DOWNLOADS}/policy.29 ${INITRD_DIR}/usr/etc/selinux/ros/policy/
  37. fi
  38. # make rancher/os-initrd image
  39. cat <<HERE > ${INITRD_DIR}/../Dockerfile.initrd
  40. FROM scratch
  41. COPY initrd/* /
  42. HERE
  43. name="os-initrd"
  44. tag="${OS_REPO}/${name}:${VERSION}${SUFFIX}"
  45. pushd .
  46. cd ${INITRD_DIR}/..
  47. docker build -t ${OS_REPO}/${name} -f Dockerfile.initrd .
  48. docker tag rancher/${name} ${tag}
  49. popd