diff --git a/snmp/hardware b/snmp/hardware new file mode 100644 index 000000000..b6636db2b --- /dev/null +++ b/snmp/hardware @@ -0,0 +1,20 @@ +#!/usr/bin/env sh +# Detects which hardware. + +if [ -r /sys/devices/virtual/dmi/id/product_name ]; then + DMI=$(cat /sys/devices/virtual/dmi/id/product_name) +fi +if [ -r /sys/firmware/devicetree/base/model ]; then + DT=$(cat /sys/firmware/devicetree/base/model) +fi + +if [ -n "${DMI}" ]; then + if [ "${DMI}" != "To Be Filled By O.E.M." ] && [ "${DMI}" != "Default string" ] && [ "${DMI}" != "Not Specified" ] && [ "${DMI}" != "None" ] ; then + HARDWARESTR="${DMI}" + fi +fi +if [ -z "${HARDWARESTR}" ] && [ -n "${DT}" ]; then + HARDWARESTR="${DT}" +fi + +echo "${HARDWARESTR}" diff --git a/snmp/manufacturer b/snmp/manufacturer new file mode 100644 index 000000000..01bafd06d --- /dev/null +++ b/snmp/manufacturer @@ -0,0 +1,14 @@ +#!/usr/bin/env sh +# Detects which manufacturer. + +if [ -r /sys/devices/virtual/dmi/id/sys_vendor ]; then + DMI=$(cat /sys/devices/virtual/dmi/id/sys_vendor) +fi + +if [ -n "${DMI}" ]; then + if [ "${DMI}" != "To Be Filled By O.E.M." ] && [ "${DMI}" != "Default string" ] && [ "${DMI}" != "Not Specified" ] && [ "${DMI}" != "None" ] ; then + MANUFACTURERSTR="${DMI}" + fi +fi + +echo "${MANUFACTURERSTR}" diff --git a/snmp/serial b/snmp/serial new file mode 100644 index 000000000..b00671ea2 --- /dev/null +++ b/snmp/serial @@ -0,0 +1,20 @@ +#!/usr/bin/env sh +# Detects which serial. + +if [ -r /sys/devices/virtual/dmi/id/product_serial ]; then + DMI=$(cat /sys/devices/virtual/dmi/id/product_serial) +fi +if [ -r /sys/firmware/devicetree/base/serial-number ]; then + DT=$(cat /sys/firmware/devicetree/base/serial-number) +fi + +if [ -n "${DMI}" ]; then + if [ "${DMI}" != "To Be Filled By O.E.M." ] && [ "${DMI}" != "Default string" ] && [ "${DMI}" != "Not Specified" ] && [ "${DMI}" != "None" ] ; then + SERIALSTR="${DMI}" + fi +fi +if [ -z "${SERIALSTR}" ] && [ -n "${DT}" ]; then + SERIALSTR="${DT}" +fi + +echo "${SERIALSTR}"