confd: minor, use initial hostname from /etc/os-release as fallback

Instead of hard-coding the fallback hostname we can now use the one
generated to /etc/os-release (for netbrowse).

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2024-05-13 11:42:27 +02:00
committed by Tobias Waldekranz
parent a05e28d349
commit ab21eff6c8
+3 -2
View File
@@ -1326,8 +1326,9 @@ static int change_hostname(sr_session_ctx_t *session, uint32_t sub_id, const cha
nm = srx_get_str(session, "%s", xpath);
if (!nm) {
/* XXX: derive from global "options.h" or /usr/share/factory/ */
nm = strdup("infix");
nm = fgetkey("/etc/os-release", "DEFAULT_HOSTNAME");
if (nm)
nm = strdup(nm);
if (!nm) {
err = SR_ERR_NO_MEMORY;
goto err;