just a share: bashrc function to change grub image on a random basis.
by BW-userx from LinuxQuestions.org on (#4Z19D)
if you like using an image in your grub boot screen, and need a change, but cannot figure out what image to pick next, just put this in your .bashrc and set up the paths to your system. then run it whenever you feel you need a change in your life.
Code:#CHANGE GRUB BOOT IMAGE USING IMAGES IN FAVORITES DIRECTORY
update-grub-favs()
{ #location of grub conf file
file=/etc/default/grub
#location of images to be used
location="/media/data/Favorites"
mapfile -t images < <(ls "$location" )
#printf "%s\n" "${images[@]}"
img=${images[$RANDOM % ${#images[@]} ]}
#if jpg change to png
#uefi grub boot on mine
#does not work with jpg
if [[ "$img" =~ 'jpg' ]] ;
then
#add absolute path
img=$location/$img
#convert jpg -2- png
convert $img ${img/%jpg/png}
#swap the extension in the variable from
#jpg to png to match
img=${img/%.*}.png
else
#just add absolute path to png
img=$location/$img
fi
echo "
using ..
$img"
#copy the image into your home to satisfy your curiosity
#without having to reboot to see it.
cp -v "$img" ~/
echo
sudo sed -i 's|GRUB_BACKGROUND.*|GRUB_BACKGROUND='"\"$img\""'|' $file
sudo grub-mkconfig -o /boot/grub/grub.cfg
}Needs 'imagemagick' installed on system for 'convert' to work.


Code:#CHANGE GRUB BOOT IMAGE USING IMAGES IN FAVORITES DIRECTORY
update-grub-favs()
{ #location of grub conf file
file=/etc/default/grub
#location of images to be used
location="/media/data/Favorites"
mapfile -t images < <(ls "$location" )
#printf "%s\n" "${images[@]}"
img=${images[$RANDOM % ${#images[@]} ]}
#if jpg change to png
#uefi grub boot on mine
#does not work with jpg
if [[ "$img" =~ 'jpg' ]] ;
then
#add absolute path
img=$location/$img
#convert jpg -2- png
convert $img ${img/%jpg/png}
#swap the extension in the variable from
#jpg to png to match
img=${img/%.*}.png
else
#just add absolute path to png
img=$location/$img
fi
echo "
using ..
$img"
#copy the image into your home to satisfy your curiosity
#without having to reboot to see it.
cp -v "$img" ~/
echo
sudo sed -i 's|GRUB_BACKGROUND.*|GRUB_BACKGROUND='"\"$img\""'|' $file
sudo grub-mkconfig -o /boot/grub/grub.cfg
}Needs 'imagemagick' installed on system for 'convert' to work.