20_sysinfo 652 B

12345678910111213141516171819202122232425262728
  1. do_sysinfo_x86() {
  2. local vendor product file
  3. for file in sys_vendor board_vendor; do
  4. vendor="$(cat /sys/devices/virtual/dmi/id/$file 2>/dev/null)"
  5. [ -n "$vendor" ] && break
  6. done
  7. for file in product_name board_name; do
  8. product="$(cat /sys/devices/virtual/dmi/id/$file 2>/dev/null)"
  9. [ -n "$product" ] && break
  10. done
  11. [ -n "$vendor" -a -n "$product" ] || return
  12. mkdir -p /tmp/sysinfo
  13. echo "$vendor $product" > /tmp/sysinfo/model
  14. sed -e '
  15. y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/;
  16. s/[^a-z0-9_-]\+/-/g;
  17. s/^-//;
  18. s/-$//;
  19. ' /tmp/sysinfo/model > /tmp/sysinfo/board_name
  20. }
  21. boot_hook_add preinit_main do_sysinfo_x86