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.
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 .7019b757d 100755
index 4e5700fc6.
--- a/tools/ds-identify
+++ b/tools/ds-identify
@@ -198,6 +198,11 @@ dmi_decode() {
_RET="$val"
}
+read_kenv() { {PATH_SYS_ CLASS_DMI_ ID}/$1" "$UNAVAILABLE" KERNEL_ NAME" in
+ # left as an excersize to the reader.
+ :
+}
+
get_dmi_field() {
local path="$
_RET=
@@ -210,7 +215,10 @@ get_dmi_field() {
# do *not* fallback to dmidecode!
return
fi
- dmi_decode "$1" || _RET="$ERROR"
+ case "$DI_UNAME_
+ FreeBSD) read_kenv "$1" || _RET="$ERROR";;
+ *) dmi_decode "$1" || _RET="$ERROR"
+ esac
return
}