From 64910d0781a29efaa7e2f365bfc6761c62e7709e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 4 Jul 2025 10:10:29 +0800 Subject: [PATCH] OS (Linux): detect fedora variants Fix #1830 --- src/detection/os/os_linux.c | 21 +++++++++++++++++++-- src/logo/builtin.c | 12 ++++-------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/detection/os/os_linux.c b/src/detection/os/os_linux.c index b87a9ce7b..0774b9816 100644 --- a/src/detection/os/os_linux.c +++ b/src/detection/os/os_linux.c @@ -291,6 +291,21 @@ FF_MAYBE_UNUSED static bool detectDebianDerived(FFOSResult* result) return false; } +FF_MAYBE_UNUSED static bool detectFedoraVariant(FFOSResult* result) +{ + if (ffStrbufEqualS(&result->variantID, "coreos") + || ffStrbufEqualS(&result->variantID, "kinoite") + || ffStrbufEqualS(&result->variantID, "sericea") + || ffStrbufEqualS(&result->variantID, "silverblue")) + { + ffStrbufAppendC(&result->id, '-'); + ffStrbufAppend(&result->id, &result->variantID); + ffStrbufSetStatic(&result->idLike, "fedora"); + return true; + } + return false; +} + static void detectOS(FFOSResult* os) { #ifdef FF_CUSTOM_OS_RELEASE_PATH @@ -341,13 +356,15 @@ void ffDetectOSImpl(FFOSResult* os) detectOS(os); #ifdef __linux__ - if(ffStrbufIgnCaseEqualS(&os->id, "ubuntu")) + if(ffStrbufEqualS(&os->id, "ubuntu")) getUbuntuFlavour(os); - else if(ffStrbufIgnCaseEqualS(&os->id, "debian")) + else if(ffStrbufEqualS(&os->id, "debian")) { if (!detectDebianDerived(os)) getDebianVersion(os); } + else if(ffStrbufEqualS(&os->id, "fedora")) + detectFedoraVariant(os); else if(ffStrbufEqualS(&os->id, "linuxmint")) { if (ffStrbufEqualS(&os->name, "LMDE")) diff --git a/src/logo/builtin.c b/src/logo/builtin.c index 76d123a69..5aef1ee72 100644 --- a/src/logo/builtin.c +++ b/src/logo/builtin.c @@ -1771,8 +1771,7 @@ static const FFlogo F[] = { }, // FedoraSilverblue { - .names = {"Fedora_silverblue", "fedora-silverblue"}, - .type = FF_LOGO_LINE_TYPE_ALTER_BIT, + .names = {"Fedora-Silverblue"}, .lines = FASTFETCH_DATATEXT_LOGO_FEDORA_SILVERBLUE, .colors = { FF_COLOR_FG_BLUE, @@ -1784,8 +1783,7 @@ static const FFlogo F[] = { }, // FedoraKinoite { - .names = {"Fedora_kinoite", "fedora-kinoite"}, - .type = FF_LOGO_LINE_TYPE_ALTER_BIT, + .names = {"Fedora-Kinoite"}, .lines = FASTFETCH_DATATEXT_LOGO_FEDORA_KINOITE, .colors = { FF_COLOR_FG_BLUE, @@ -1796,8 +1794,7 @@ static const FFlogo F[] = { }, // FedoraSericea { - .names = {"Fedora_sericea", "fedora-sericea"}, - .type = FF_LOGO_LINE_TYPE_ALTER_BIT, + .names = {"Fedora-Sericea"}, .lines = FASTFETCH_DATATEXT_LOGO_FEDORA_SERICEA, .colors = { FF_COLOR_FG_BLUE, @@ -1808,8 +1805,7 @@ static const FFlogo F[] = { }, // FedoraCoreOS { - .names = {"Fedora_coreos", "fedora-coreos"}, - .type = FF_LOGO_LINE_TYPE_ALTER_BIT, + .names = {"Fedora-CoreOS"}, .lines = FASTFETCH_DATATEXT_LOGO_FEDORA_COREOS, .colors = { FF_COLOR_FG_BLUE,