You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.3 KiB

  1. #!/bin/bash
  2. # SPDX-License-Identifier: GPL-3.0+
  3. # Copyright (C) 2018, Martin Kepplinger <martink@posteo.de>
  4. source functions.sh
  5. set -e
  6. usage()
  7. {
  8. echo "Skulls for the X230"
  9. echo " Run this script on the X230 directly."
  10. echo " It checks BIOS and hardware for relevant"
  11. echo " things if you plan to install Skulls"
  12. echo " please make sure dmidecode is installed"
  13. echo ""
  14. echo "Usage: $0"
  15. }
  16. args=$(getopt -o h -- "$@")
  17. if [ $? -ne 0 ] ; then
  18. usage
  19. exit 1
  20. fi
  21. eval set -- "$args"
  22. while [ $# -gt 0 ]
  23. do
  24. case "$1" in
  25. -h)
  26. usage
  27. exit 1
  28. ;;
  29. --)
  30. shift
  31. break
  32. ;;
  33. *)
  34. echo "Invalid option: $1"
  35. exit 1
  36. ;;
  37. esac
  38. shift
  39. done
  40. force_x230_and_root
  41. BIOS_VENDOR=$(dmidecode -t bios | grep Vendor | cut -d':' -f2)
  42. if [[ $BIOS_VENDOR = *"coreboot"* ]] ; then
  43. echo "coreboot already intalled. This script is useless then."
  44. exit 0
  45. fi
  46. BIOS_VERSION=$(dmidecode -s bios-version | grep -o '[1-2].[0-7][0-9]')
  47. bios_major=$(echo "$BIOS_VERSION" | cut -d. -f1)
  48. bios_minor=$(echo "$BIOS_VERSION" | cut -d. -f2)
  49. if [ "${bios_minor}" -ge "60" ] ; then
  50. echo "installed BIOS version is ${bios_major}.${bios_minor}."
  51. else
  52. echo -e "The installed original BIOS is very old and doesn't include the latest Embedded Controller Firmware."
  53. echo -e "${RED}Please upgrade${NC} before installing coreboot."
  54. fi