Merge pull request #366 from nitkon/dns_initrd

initrd_builder: Create empty resolv.conf in rootfs
This commit is contained in:
Salvador Fuentes
2019-09-26 12:04:39 -05:00
committed by GitHub
2 changed files with 9 additions and 3 deletions

View File

@@ -391,9 +391,6 @@ create_rootfs_image() {
info "Creating empty machine-id to allow systemd to bind-mount it" info "Creating empty machine-id to allow systemd to bind-mount it"
touch "${mount_dir}/etc/machine-id" touch "${mount_dir}/etc/machine-id"
info "Creating empty resolv.conf to allow kata-agent to bind-mount it"
touch "${mount_dir}/etc/resolv.conf"
info "Unmounting root partition" info "Unmounting root partition"
umount "${mount_dir}" umount "${mount_dir}"
OK "Root partition unmounted" OK "Root partition unmounted"

View File

@@ -510,6 +510,15 @@ EOT
[ -x "${init}" ] || [ -L "${init}" ] || die "/sbin/init is not installed in ${ROOTFS_DIR}" [ -x "${init}" ] || [ -L "${init}" ] || die "/sbin/init is not installed in ${ROOTFS_DIR}"
OK "init is installed" OK "init is installed"
# Create an empty /etc/resolv.conf, to allow agent to bind mount container resolv.conf to Kata VM
dns_file="${ROOTFS_DIR}/etc/resolv.conf"
if [ -L "$dns_file" ]; then
# if /etc/resolv.conf is a link, it cannot be used for bind mount
rm -f "$dns_file"
fi
info "Create /etc/resolv.conf file in rootfs if not exist"
touch "$dns_file"
info "Creating summary file" info "Creating summary file"
create_summary_file "${ROOTFS_DIR}" create_summary_file "${ROOTFS_DIR}"
} }