Append /etc/resolv.conf.tail if it exists

This commit is contained in:
reykfloeter 2019-11-29 17:06:39 +00:00
parent 0b1fee287c
commit beef9f736c
2 changed files with 12 additions and 1 deletions

View file

@ -1,5 +1,10 @@
# Changelog # Changelog
## v1.0 (2019-11-29)
* Append `/etc/resolv.conf.tail` to `/etc/resolv.conf` if it exists.
* Fixed usage.
## v0.9 (2019-06-26) ## v0.9 (2019-06-26)
* Added support for `-c` to specify the probing order of different cloud stacks. * Added support for `-c` to specify the probing order of different cloud stacks.

View file

@ -838,7 +838,7 @@ agent_network(struct system_config *sc)
const char *family; const char *family;
char domain[(NI_MAXHOST + 1) * 6 + 8]; /* up to 6 domains */ char domain[(NI_MAXHOST + 1) * 6 + 8]; /* up to 6 domains */
int has_domain = 0; int has_domain = 0;
char ifidx[UINT16_MAX]; char ifidx[UINT16_MAX], *str;
const char *comment = "# Generated by cloud-agent"; const char *comment = "# Generated by cloud-agent";
if (!sc->sc_network) if (!sc->sc_network)
@ -907,6 +907,12 @@ agent_network(struct system_config *sc)
if (has_domain) if (has_domain)
fileout(domain, "a", "/etc/resolv.conf"); fileout(domain, "a", "/etc/resolv.conf");
/* append resolv.conf.tail if it exists */
if ((str = filein("r", "/etc/resolv.conf.tail")) != NULL) {
fileout(str, "a", "/etc/resolv.conf");
free(str);
}
return (0); return (0);
} }