grub 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/usr/bin/env bash
  2. # helper script: Downloads GRUB and patches it.
  3. #
  4. # Copyright (C) 2014, 2015, 2016, 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 grub"
  24. printf "Usage:\n"
  25. printf "\t%s # %s\n" \
  26. "${progname}" \
  27. "Download GRUB"
  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. # Remove the old version that may still exist
  37. # ------------------------------------------------------------------------------
  38. printf "Downloading GRUB\n"
  39. rm -Rf "grub/"
  40. # Get latest GRUB
  41. # ------------------------------------------------------------------------------
  42. # download it using git
  43. git clone git://git.savannah.gnu.org/grub.git || git clone http://git.savannah.gnu.org/r/grub.git
  44. if [ ! -d "grub" ]; then
  45. printf "grub not downloaded; check network connection?\n\n"
  46. exit 1
  47. fi
  48. (
  49. # modifications are required
  50. cd "grub/"
  51. # reset to known revision
  52. git reset --hard 50aace6bdb918150ba47e3c16146dcca271c134a
  53. for grubpatch in ../resources/grub/patches/*; do
  54. git am "${grubpatch}"
  55. done
  56. git clone git://git.sv.gnu.org/gnulib gnulib
  57. cd gnulib/
  58. # NOTE: when updating this, make sure it's the version specified
  59. # in bootstrap.conf on that version of GRUB, as specified above
  60. git reset --hard d271f868a8df9bbec29049d01e056481b7a1a263
  61. rm -Rf .git*
  62. )
  63. printf "\n\n"