memtest86plus 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/usr/bin/env bash
  2. # helper script: Downloads MemTest86+ and patches it
  3. #
  4. # Copyright (C) 2014, 2015, 2020, 2021 Leah Rowe <info@minifree.org>
  5. # Copyright (C) 2015 Joseph Michael Thompson <jmt@josepht.me>
  6. # Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
  7. #
  8. # This program is free software: you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation, either version 3 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. #
  21. [ "x${DEBUG+set}" = 'xset' ] && set -v
  22. set -u -e
  23. # Get the last version of MemTest86+ used, apply patches, build it.
  24. # Remove the old version that may exist
  25. # ------------------------------------------------------------------------------
  26. printf "Downloading MemTest86+\n"
  27. rm -Rf "memtest86plus/"
  28. # Get latest memtest86+:
  29. # ------------------------------------------------------------------------------
  30. # download it using wget
  31. wget http://memtest.org/download/5.31b/memtest86+-5.31b.tar.gz
  32. if [ "$(sha512sum memtest86+-5.31b.tar.gz | cut -c1-128)" = "ad5891fd0c430ce7a5d0cde2d10dee20b66ad8060d47c3e70e038461d9cde3a78dfc13442b5b09da7c662741945a670353c72dbc08fd5ee8bae82256001a9541" ]; then
  33. printf "Valid checksum for memtest86plus\n"
  34. else
  35. rm -f "memtest86+-5.31b.tar.gz"
  36. printf "Invalid checksum for memtest86plus, or memtest86plus not downloaded\n"
  37. exit 1
  38. fi
  39. # extract it
  40. tar -xzf "memtest86+-5.31b.tar.gz"
  41. # delete the tar file (no longer needed)
  42. rm -f "memtest86+-5.31b.tar.gz"
  43. # make direcotory name consistent
  44. mv "memtest86+-5.31b/" "memtest86plus/"
  45. # Apply necessary patches
  46. # ------------------------------------------------------------------------------
  47. (
  48. cd "memtest86plus/"
  49. for patch in ../resources/memtest86plus/patch/*; do
  50. patch < "${patch}"
  51. done
  52. )
  53. printf "\n\n"