grub-background 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. [ "x${DEBUG+set}" = 'xset' ] && set -v
  21. set -u -e
  22. if (( $# != 2 )); then
  23. echo "Usage: ./grub-background /path/to/libreboot.rom /path/to/image.jpg"
  24. exit 1
  25. fi
  26. if [ ! -f $1 ]; then
  27. echo "File not found!"
  28. exit 1
  29. fi
  30. if [ ! -f $2 ]; then
  31. echo "File not found!"
  32. exit 1
  33. fi
  34. rompath=$1
  35. jpegpath=$2
  36. arch="unknown"
  37. if [ $(uname -i) = "armv7l" ] || [ $(uname -m) = "armv7l" ]; then
  38. arch="armv7l"
  39. elif [ $(uname -i) = "i686" ] || [ $(uname -m) = "i686" ]; then
  40. arch="i686"
  41. elif [ $(uname -i) = "x86_64" ] || [ $(uname -m) = "x86_64" ]; then
  42. arch="x86_64"
  43. else
  44. echo "Unknown host architecture"
  45. exit 1
  46. fi
  47. cbfstool="./cbfstool/$arch/cbfstool"
  48. $cbfstool "$rompath" remove -n background.jpg
  49. $cbfstool "$rompath" add -f "$jpegpath" -n background.jpg -t raw