Skip to content

Configure /etc/resolv.conf and persist hostname

Benjamin Drung requested to merge bdrung/initramfs-tools:resolv.conf into master

live-boot generates /etc/hostname, /etc/hosts, and /etc/resolv.conf in do_netsetup from 9990-networking.sh. kdump-tools needs similar code for generating a self-contained initrd for dumping a crashed kernel via network.

Ubuntu carries a patch for initramfs-tools that adds netinfo_to_resolv_conf to configure /etc/resolv.conf which is more complex than the code from live-boot.

To prevent code duplication, implement netinfo_to_resolv_conf and persist_hostname as helper functions and let configure_networking call these functions.

Let netinfo_to_resolv_conf support multiple /run/net-<device> style files to allow Ubuntu to reuse this code.

The second commit adds unit tests for netinfo_to_resolv_conf.

Edited by Benjamin Drung

Merge request reports

Loading