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.

68 lines
1.5 KiB

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