install.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #! /usr/bin/env bash
  2. THEME='lenovo-grub-theme'
  3. # Pre-authorise sudo
  4. sudo echo
  5. GRUB_DIR='grub'
  6. UPDATE_GRUB='update-grub'
  7. echo 'Fetching theme archive'
  8. wget https://github.com/ds1david/${THEME}/archive/master.zip
  9. echo 'Unpacking theme'
  10. unzip master.zip
  11. echo 'Creating GRUB themes directory'
  12. sudo mkdir -p /boot/${GRUB_DIR}/themes/${THEME}
  13. echo 'Copying theme to GRUB themes directory'
  14. sudo cp -r ${THEME}-master/* /boot/${GRUB_DIR}/themes/${THEME}
  15. echo 'Removing other themes from GRUB config'
  16. sudo sed -i '/^GRUB_THEME=/d' /etc/default/grub
  17. echo 'Making sure GRUB uses graphical output'
  18. sudo sed -i 's/^\(GRUB_TERMINAL\w*=.*\)/#\1/' /etc/default/grub
  19. echo 'Removing empty lines at the end of GRUB config' # optional
  20. sudo sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' /etc/default/grub
  21. udo
  22. echo 'Adding new line to GRUB config just in case' # optional
  23. echo | sudo tee -a /etc/default/grub
  24. echo 'Adding theme to GRUB config'
  25. echo "GRUB_THEME=/boot/${GRUB_DIR}/themes/${THEME}/theme.txt" | sudo tee -a /etc/default/grub
  26. echo 'Removing theme installation files'
  27. rm -rf master.zip ${THEME}-master
  28. if [ -e /usr/share/plymouth/themes/default.grub ]; then
  29. echo 'Removing blink purple screen'
  30. sudo cat << ' EOF' >> /usr/share/plymouth/themes/ubuntu-logo/ubuntu-logo.grub
  31. if background_color 0,0,0; then
  32. clear
  33. fi
  34. EOF
  35. fi
  36. echo 'Updating GRUB'
  37. eval sudo "$UPDATE_GRUB"