diff --git a/CHANGELOG.md b/CHANGELOG.md index ab5db85b2f..1ffae2a91b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ Changes: * Redhat Virtio GPUs are now reported as integrated instead of discrete. (GPU, Linux) Bugfixes: +* Fixed OS detection on FreeBSD when the configured etc directory is `/usr/local/etc` and the release file is in `/etc`. (OS, FreeBSD) * Fixed libc version detection on FreeBSD without binutils installed, and on DragonFly BSD. (Libc, FreeBSD / DragonFly) * Fixed CPU cache detection failing entirely when any CPU is offline. (#2736, CPUCache, Linux) * Fixed the scale factor of rotated monitors on Wayland, e.g. a 1920x1200 monitor rotated by 90 degrees at scale 1 being reported as `@ 1.59x`. (Display, Linux) diff --git a/src/detection/os/os_linux.c b/src/detection/os/os_linux.c index 02dcb240ac..f3e56ab420 100644 --- a/src/detection/os/os_linux.c +++ b/src/detection/os/os_linux.c @@ -383,6 +383,14 @@ static void detectOS(FFOSResult* os) { parseOsRelease(FASTFETCH_TARGET_DIR_ETC "/os-release", os); +#if defined(__FreeBSD__) + // Ports may set TARGET_DIR_ETC to /usr/local/etc, while FreeBSD's base + // system provides /etc/os-release. Keep the configured path's precedence. + if (os->id.length == 0 && os->name.length == 0 && os->prettyName.length == 0) { + parseOsRelease(FASTFETCH_TARGET_DIR_ROOT "/etc/os-release", os); + } +#endif + if (os->id.length == 0 || os->version.length == 0 || os->prettyName.length == 0 || os->codename.length == 0) { parseLsbRelease(FASTFETCH_TARGET_DIR_ETC "/lsb-release", os); }