File 0001-cockpit-overview-support-SUSE_SUPPORT_PRODUCT-keys.patch of Package cockpit
From ec3a1efce07770b7641e07d41a73732967c65175 Mon Sep 17 00:00:00 2001
From: Luna D Dragon <luna.dragon@suse.com>
Date: Tue, 8 Jul 2025 14:58:03 +0530
Subject: [PATCH 1/3] cockpit overview: support SUSE_SUPPORT_PRODUCT keys
SLE Micro 6.2(and Framework one components) have custom os-release keys namely in SUSE_SUPPORT_PRODUCT and
SUSE_SUPPORT_PRODUCT_VERSION instead of the standard os prettyname which
results in systemd not being able to determine the os name correctly.
This patch should be dropped when systemd is fixed
---
pkg/systemd/overview.jsx | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/pkg/systemd/overview.jsx b/pkg/systemd/overview.jsx
index 868469d68..186fcf59e 100644
--- a/pkg/systemd/overview.jsx
+++ b/pkg/systemd/overview.jsx
@@ -42,6 +42,7 @@ import { ShutdownModal } from 'cockpit-components-shutdown.jsx';
import { WithDialogs, DialogsContext } from "dialogs.jsx";
import "./overview.scss";
+import { read_os_release } from "os-release.js";
const _ = cockpit.gettext;
@@ -98,6 +99,7 @@ class OverviewPage extends React.Component {
this.hostname_proxy.addEventListener("changed", data => {
this.setState({ hostnameData: data.detail });
});
+ read_os_release().then(os_release => this.setState({ os_release }));
}
render() {
@@ -160,8 +162,12 @@ class OverviewPage extends React.Component {
{this.hostname_text()}
</h1>
{this.state.hostnameData &&
- this.state.hostnameData.OperatingSystemPrettyName &&
- <div className="ct-overview-header-subheading" id="system_information_os_text">{cockpit.format(_("running $0"), this.state.hostnameData.OperatingSystemPrettyName)}</div>}
+ this.state.hostnameData.OperatingSystemPrettyName && (
+ <div className="ct-overview-header-subheading" id="system_information_os_text">
+ {(this.state.os_release && this.state.os_release.SUSE_PRETTY_NAME)
+ ? cockpit.format(_("running $0"), this.state.os_release.SUSE_PRETTY_NAME)
+ : cockpit.format(_("running $0"), this.state.hostnameData.OperatingSystemPrettyName)}
+ </div>)}
</div>
<div className='ct-overview-header-actions'>
{ show_superuser && <SuperuserIndicator proxy={this.superuser} /> }
diff --git a/src/common/cockpitsystem.c b/src/common/cockpitsystem.c
index 83e2965f7..73716fff7 100644
--- a/src/common/cockpitsystem.c
+++ b/src/common/cockpitsystem.c
@@ -107,6 +107,12 @@ cockpit_system_load_os_release (void)
}
}
+ gchar *value = g_hash_table_lookup (result, "SUSE_PRETTY_NAME");
+ if (!value || strlen(value) == 0) {
+ value = g_hash_table_lookup (result, "PRETTY_NAME");
+ g_hash_table_replace (result, g_strdup ("SUSE_PRETTY_NAME"), g_strdup (value));
+ }
+
out:
g_clear_error (&error);
g_free (lines);
--
2.50.0