martedì 2 marzo 2010

cambiare sfondo alla schermata di grub

IL nuovo grub2 montato sul nuovo ubuntu 9.10 porta notevoli cambiamenti rispetto al vecchio grub, il file di configurazione menu.lst non viene più utilizzato, al suo posto per intervenire sulle configurazioni di base bisogna intervenire sui file /etc/default/grub ed /etc/grub.d/05_debian_theme.

Il primo file serve per selezionare le opzioni di avvio dei sistemi operativi.

cat /etc/default/grub


GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT="10"
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="splash quiet"
GRUB_CMDLINE_LINUX=""

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entrys
#GRUB_DISABLE_LINUX_RECOVERY="true"


Il secondo file serve per scegliere delle immagini personalizzati al boot di grub, le immagini possono essere in formato png o jpg, la riga da cambiare è quella in rosso dove bisogna indicare dentro la cartella /usr/share/image/desktop-base l'immagine da caricare all'avvio.


cat /etc/grub.d/05_debian_theme


#!/bin/bash -e

source /usr/lib/grub/grub-mkconfig_lib

set_mono_theme()
{
cat << menu_color_normal="white/black" menu_color_highlight="black/white" use_bg="false" style="font-weight: bold; color: rgb(255, 0, 0);">for i in {/boot/grub,/usr/share/images/desktop-base}/moreblue-orbit-grub.{png,tga} ; do
if is_path_readable_by_grub $i ; then
bg=$i
case ${bg} in
*.png) reader=png ;;
*.tga) reader=tga ;;
*.jpg|*.jpeg) reader=jpeg ;;
esac
if test -e /boot/grub/${reader}.mod ; then
echo "Found Debian background: `basename ${bg}`" >&2
use_bg=true
break
fi
fi
done
fi

# set the background if possible
if ${use_bg} ; then
prepare_grub_to_access_device `${grub_probe} --target=device ${bg}`
cat << color_normal="black/black" color_highlight="magenta/black" style="font-weight: bold; color: rgb(255, 0, 0);">/usr/share/images/desktop-base

sudo cp -fr prova.png /usr/share/images/desktop-base/


cambiamo la riga :

for i in {/boot/grub,/usr/share/images/desktop-base}/moreblue-orbit-grub.{png,tga} ; do

in

for i in {/boot/grub,/usr/share/images/desktop-base}/prova.png{png,tga} ; do

salviamo i risultati con il comando:

sudo update-grub

riavviamo il pc, al prossimo riavvio ci troveremo con l'immagine dello sfondo cambiata.

Se utilizzate immagini jpg la risoluzione massima deve essere di 8 bit.

Nessun commento: