2021-08-03 15:02:44 +02:00
|
|
|
From c6ed74889adade0287ee609150611544d8d5c6d2 Mon Sep 17 00:00:00 2001
|
2020-09-04 08:47:46 +02:00
|
|
|
From: Frederic Crozat <fcrozat@suse.com>
|
|
|
|
Date: Tue, 28 May 2013 15:17:35 +0200
|
2021-08-03 15:02:44 +02:00
|
|
|
Subject: [PATCH 04/11] strip the domain part from /etc/hostname when setting
|
2020-09-04 08:47:46 +02:00
|
|
|
system host name
|
|
|
|
|
|
|
|
[fbui: fixes bnc#820213]
|
|
|
|
[fbui: forwardported from bfd2462b8ddec591d953841ab22bb30bdc6f9085]
|
|
|
|
[fbui: adjust context and make sure that strip of the domain name is
|
|
|
|
only done when setting the system host name. Therefore it's
|
|
|
|
still possible to pass an FQDN to hostnamectl]
|
|
|
|
[fbui: I'm still not sure that it was the right thing to do. Other
|
|
|
|
possibility was to fix the installer to create a correct
|
|
|
|
/etc/hostname file. Need to investigate...]
|
|
|
|
---
|
2021-04-28 14:31:30 +02:00
|
|
|
src/shared/hostname-setup.c | 7 +++++++
|
|
|
|
1 file changed, 7 insertions(+)
|
2020-09-04 08:47:46 +02:00
|
|
|
|
2021-04-28 14:31:30 +02:00
|
|
|
diff --git a/src/shared/hostname-setup.c b/src/shared/hostname-setup.c
|
|
|
|
index 511aa7d031..351d0e761d 100644
|
|
|
|
--- a/src/shared/hostname-setup.c
|
|
|
|
+++ b/src/shared/hostname-setup.c
|
|
|
|
@@ -189,6 +189,13 @@ int hostname_setup(bool really) {
|
2020-09-04 08:47:46 +02:00
|
|
|
else
|
|
|
|
log_warning_errno(r, "Failed to read configured hostname: %m");
|
2021-04-28 14:31:30 +02:00
|
|
|
} else {
|
2020-09-04 08:47:46 +02:00
|
|
|
+ char *domain;
|
|
|
|
+
|
|
|
|
+ /* SUSE: strip the domain name */
|
|
|
|
+ domain = strchr(b, '.');
|
|
|
|
+ if (domain)
|
|
|
|
+ *domain = '\0';
|
|
|
|
+
|
|
|
|
hn = b;
|
2021-04-28 14:31:30 +02:00
|
|
|
source = HOSTNAME_STATIC;
|
|
|
|
}
|
2020-09-04 08:47:46 +02:00
|
|
|
--
|
|
|
|
2.26.2
|
|
|
|
|