flashrom 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/usr/bin/env bash
  2. # helper script: downloads flashrom and patches it
  3. #
  4. # Copyright (C) 2014, 2015, 2020, 2021 Leah Rowe <info@minifree.org>
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. [ "x${DEBUG+set}" = 'xset' ] && set -v
  20. set -u -e
  21. usage()
  22. {
  23. progname="./download flashrom"
  24. printf "Usage:\n"
  25. printf "\t%s # %s\n" \
  26. "${progname}" \
  27. "Download flashrom"
  28. printf "\t%s --help # %s\n" \
  29. "${progname}" \
  30. "Prints this help"
  31. }
  32. if [ $# -ne 0 ] ; then
  33. usage
  34. exit 0
  35. fi
  36. # Get flashrom at the last previously tested revision
  37. # Remove the old version that may still exist:
  38. # ------------------------------------------------------------------------------
  39. printf "Downloading flashrom\n"
  40. rm -Rf "flashrom/"
  41. # Get flashrom
  42. # ------------------------------------------------------------------------------
  43. # download it using git
  44. git clone https://review.coreboot.org/flashrom.git
  45. if [ ! -d "flashrom" ]; then
  46. printf "flashrom not downloaded; check network connection?\n\n"
  47. exit 1
  48. fi
  49. (
  50. cd "flashrom/"
  51. # reset to known revision
  52. git reset --hard v1.2
  53. )
  54. printf "\n\n"