Comment 1 for bug 1900753

Revision history for this message
Scott Moser (smoser) wrote :

We don't strictly have a dependency on dmidecode.
ds-identify will only try dmidecode if values in /sys/class/dmi/id/ are not present. That is desirable, as reading files from /sys is orders of magnitude faster than invoking a program to do the same.

I think calling kenv on freebsd would be fine.

something like this:

diff --git a/tools/ds-identify b/tools/ds-identify
index 4e5700fc6..7019b757d 100755
--- a/tools/ds-identify
+++ b/tools/ds-identify
@@ -198,6 +198,11 @@ dmi_decode() {
     _RET="$val"
 }

+read_kenv() {
+ # left as an excersize to the reader.
+ :
+}
+
 get_dmi_field() {
     local path="${PATH_SYS_CLASS_DMI_ID}/$1"
     _RET="$UNAVAILABLE"
@@ -210,7 +215,10 @@ get_dmi_field() {
         # do *not* fallback to dmidecode!
         return
     fi
- dmi_decode "$1" || _RET="$ERROR"
+ case "$DI_UNAME_KERNEL_NAME" in
+ FreeBSD) read_kenv "$1" || _RET="$ERROR";;
+ *) dmi_decode "$1" || _RET="$ERROR"
+ esac
     return
 }