diff --git a/CHANGELOG.md b/CHANGELOG.md index ab5db85b2..99b68aa64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ Bugfixes: * Fixed out-of-bounds reads when parsing malformed CTA-861 EDID extensions. (General) * Fixed the init system executable path being truncated on platforms where POSIX `basename()` modifies its argument. (InitSystem, Linux) * Fixed undefined behavior from passing negative `char` values to ctype functions. (General) +* Fixed OS detection failed when `TARGET_DIR_ETC` is set on FreeBSD. (OS, FreeBSD) Logos: * Updated the CuerdOS logo and colors (#2712) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee8ca3f83..80a6d60d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -836,7 +836,7 @@ elseif(FreeBSD) src/detection/mouse/mouse_bsd.c src/detection/netio/netio_bsd.c src/detection/opengl/opengl_linux.c - src/detection/os/os_linux.c + src/detection/os/os_bsd.c src/detection/packages/packages_bsd.c src/detection/poweradapter/poweradapter_nosupport.c src/detection/gtk_qt/qt.c diff --git a/src/detection/os/os_bsd.c b/src/detection/os/os_bsd.c new file mode 100644 index 000000000..29564f766 --- /dev/null +++ b/src/detection/os/os_bsd.c @@ -0,0 +1,27 @@ +#include "os.h" +#include "common/properties.h" +#include "common/strutil.h" + +void ffDetectOSImpl(FFOSResult* result) { + ffParsePropFileValues( +#ifdef FF_CUSTOM_OS_RELEASE_PATH + FF_STR(FF_CUSTOM_OS_RELEASE_PATH) +#else + "/etc/os-release" +#endif + , + 11, + (FFpropquery[]){ + { "PRETTY_NAME =", &result->prettyName }, + { "NAME =", &result->name }, + { "ID =", &result->id }, + { "ID_LIKE =", &result->idLike }, + { "VARIANT =", &result->variant }, + { "VARIANT_ID =", &result->variantID }, + { "VERSION =", &result->version }, + { "VERSION_ID =", &result->versionID }, + { "VERSION_CODENAME =", &result->codename }, + { "CODENAME =", &result->codename }, + { "BUILD_ID =", &result->buildID }, + }); +} diff --git a/src/detection/os/os_linux.c b/src/detection/os/os_linux.c index 02dcb240a..2f270f1b0 100644 --- a/src/detection/os/os_linux.c +++ b/src/detection/os/os_linux.c @@ -403,7 +403,6 @@ static void detectOS(FFOSResult* os) { void ffDetectOSImpl(FFOSResult* os) { detectOS(os); -#if __linux__ || __GNU__ if (ffStrbufEqualS(&os->id, "ubuntu")) { if (!getUbuntuFlavour(os)) { if (!ffStrbufEndsWithS(&os->prettyName, " (development branch)")) { @@ -426,5 +425,4 @@ void ffDetectOSImpl(FFOSResult* os) { } else if (ffStrbufEqualS(&os->id, "astra")) { detectAstraVersion(os); } -#endif }