grub-background 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/bash
  2. #
  3. # grub-background script: change the GRUB background in libreboot
  4. #
  5. # Copyright (C) 2015 Francis Rowe <info@gluglug.org.uk>
  6. #
  7. # This program is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. #
  20. set -u -e -v
  21. if (( $# != 1 )); then
  22. echo "Usage: ./grub-background /path/to/image.jpg"
  23. echo "You need to specify exactly 1 argument"
  24. exit 1
  25. fi
  26. if [ ! -f $1 ]; then
  27. echo "File not found!"
  28. exit 1
  29. fi
  30. path="unknown"
  31. if [ -f "DEBLOB" ]; then
  32. path="./coreboot/util/cbfstool/cbfstool"
  33. elif [ $(uname -i) = "armv7l" ] || [ $(uname -m) = "armv7l" ]; then
  34. path="./cbfstool/armv7l/cbfstool"
  35. elif [ $(uname -i) = "i686" ] || [ $(uname -m) = "i686" ]; then
  36. path="./cbfstool/i686/cbfstool"
  37. elif [ $(uname -i) = "x86_64" ] || [ $(uname -m) = "x86_64" ]; then
  38. path="./cbfstool/x86_64/cbfstool"
  39. else
  40. echo "grub-background script: Unknown host."
  41. exit 1
  42. fi
  43. cd bin/
  44. for board in $(ls)
  45. do
  46. cd "$board"/
  47. for file in $(ls *vesafb*)
  48. do
  49. cd ../../
  50. $path bin/"$board"/"$file" remove -n background.jpg
  51. $path bin/"$board"/"$file" add -f "$1" -n background.jpg -t raw
  52. cd bin/"$board"/
  53. done
  54. cd ../
  55. done