01_sysinfo 779 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. sanitize_name_x86() {
  2. sed -e '
  3. y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/;
  4. s/[^a-z0-9_-]\+/-/g;
  5. s/^-//;
  6. s/-$//;
  7. ' "$@"
  8. }
  9. do_sysinfo_x86() {
  10. local vendor product file
  11. for file in sys_vendor board_vendor; do
  12. vendor="$(cat /sys/devices/virtual/dmi/id/$file 2>/dev/null)"
  13. [ -n "$vendor" ] && break
  14. done
  15. for file in product_name board_name; do
  16. product="$(cat /sys/devices/virtual/dmi/id/$file 2>/dev/null)"
  17. case "$vendor:$product" in
  18. "Supermicro:Super Server")
  19. continue
  20. ;;
  21. ?*:?*)
  22. break
  23. ;;
  24. esac
  25. done
  26. [ -n "$vendor" -a -n "$product" ] || return
  27. mkdir -p /tmp/sysinfo
  28. echo "$vendor $product" > /tmp/sysinfo/model
  29. sanitize_name_x86 /tmp/sysinfo/model > /tmp/sysinfo/board_name
  30. }
  31. boot_hook_add preinit_main do_sysinfo_x86