Model: Add checks for more files

This commit is contained in:
Dylan Araps 2016-08-27 08:48:43 +10:00
parent f3ac997826
commit f7353a6b64
1 changed files with 11 additions and 2 deletions

View File

@ -41,8 +41,17 @@ getos() {
getmodel() {
case "$os" in
"Linux")
if [ -f /sys/devices/virtual/dmi/id/product_name ] ||\
[ -f /sys/devices/virtual/dmi/id/product_version ]; then
model="$(cat /sys/devices/virtual/dmi/id/product_{name,version} 2>/dev/null)"
model="${model/To Be Filled*}"
elif [ -f /sys/firmware/devicetree/base/model ]; then
model="$(< /sys/firmware/devicetree/base/model)"
elif [ -f /tmp/sysinfo/model ]; then
model="$(< /tmp/sysinfo/model)"
fi
;;
"Mac OS X") model="$(sysctl -n hw.model)" ;;