diff --git a/0025-get-os-release-version.patch b/0025-get-os-release-version.patch new file mode 100644 index 0000000000000000000000000000000000000000..5cc3dafbb3e8441d542429f036ae5fb1b05c2bc1 --- /dev/null +++ b/0025-get-os-release-version.patch @@ -0,0 +1,72 @@ +From f69963d210e516b707a8974a4d628147787926b9 Mon Sep 17 00:00:00 2001 +From: lw520203 <1823363429@qq.com> +Date: Fri, 2 May 2025 16:46:56 +0800 +Subject: [PATCH] get os release version + +--- + src/branding/default/branding.desc | 2 +- + src/calamares/CalamaresApplication.cpp | 28 ++++++++++++++++++++++++++ + 2 files changed, 29 insertions(+), 1 deletion(-) + +diff --git a/src/branding/default/branding.desc b/src/branding/default/branding.desc +index 9f0843385..f4e6e2a7c 100644 +--- a/src/branding/default/branding.desc ++++ b/src/branding/default/branding.desc +@@ -121,7 +121,7 @@ navigation: widget + # are visible as buttons there if the corresponding *show* keys + # are set to "true" (they can also be overridden). + strings: +- productName: "${NAME}" ++ productName: @OS_VERSION@ + shortProductName: Generic + version: 24.09 + shortVersion: 24.09 +diff --git a/src/calamares/CalamaresApplication.cpp b/src/calamares/CalamaresApplication.cpp +index 6b62fd67d..60cc815fc 100644 +--- a/src/calamares/CalamaresApplication.cpp ++++ b/src/calamares/CalamaresApplication.cpp +@@ -34,6 +34,8 @@ + #include + #include + #include ++#include ++#include + + /// @brief Convenience for "are the settings in debug mode" + static bool +@@ -158,6 +160,32 @@ CalamaresApplication::initQmlPath() + void + CalamaresApplication::initBranding() + { ++ ++ auto rse = Calamares::System::runCommand({"cat", "/etc/os-release"}, std::chrono::seconds(30)); ++ QString osVersion = rse.getOutput().split("PRETTY_NAME=\"")[1].split("\"\n")[0].replace(" ", "-"); ++ cDebug() << "osVersion is " << osVersion; ++ QFile descFile("/usr/share/calamares/branding/default/branding.desc"); ++ if (descFile.open(QIODevice::ReadOnly | QIODevice::Text)) { // 改为只读模式 ++ // 读取内容 ++ QTextStream inStream(&descFile); ++ QString content = inStream.readAll(); ++ descFile.close(); // 关闭文件 ++ ++ // 执行替换 ++ content.replace("@OS_VERSION@", osVersion); ++ ++ // 重新打开文件写入 ++ if (descFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { ++ QTextStream outStream(&descFile); ++ outStream << content; ++ descFile.close(); ++ } else { ++ qDebug() << "写入失败:" << descFile.errorString(); ++ } ++ } else { ++ qDebug() << "打开失败:" << descFile.errorString(); ++ } ++ + QString brandingComponentName = Calamares::Settings::instance()->brandingComponentName(); + if ( brandingComponentName.simplified().isEmpty() ) + { +-- +2.46.0 + diff --git a/calamares.spec b/calamares.spec index 9171199a880266a2226238f4f22430eeaff046d1..d1dcf6753b7009f47f641ed65baf28db877927d4 100644 --- a/calamares.spec +++ b/calamares.spec @@ -2,7 +2,7 @@ Name: calamares Version: 3.3.7 -Release: 16 +Release: 17 Summary: Installer from a live CD/DVD/USB to disk License: GPL-3.0-or-later @@ -66,6 +66,7 @@ Patch20: 0021-aarch64-start-desktop-failed.patch Patch21: 0022-add-gnome-user-docs-dependency.patch Patch22: 0023-add-module-dependency.patch Patch23: 0024-add-mcp-server-dependency.patch +Patch24: 0025-get-os-release-version.patch # Calamares is only supported where live images (and GRUB) are. (#1171380) # This list matches the arches where grub2-efi is used to boot the system @@ -358,6 +359,9 @@ cd %{_builddir} || exit 0 rm -rf %{buildroot} %changelog +* Wed Jun 04 2025 Liu Wang <1823363429@qq.com> - 3.3.7-17 +- Get os release version + * Tue Jun 03 2025 Liu Wang <1823363429@qq.com> - 3.3.7-16 - Add euler-copilot-web server