Wiki Ubuntu-it

Indice
Partecipa
FAQ
Wiki Blog
------------------
Ubuntu-it.org
Forum
Chiedi
Chat
Cerca
Planet
  • Pagina non alterabile
  • Informazioni
  • Allegati
  • Differenze per "Cestino/Burg"
Differenze tra le versioni 2 e 40 (in 38 versioni)
Versione 2 del 19/02/2011 15.19.00
Dimensione: 27959
Commento:
Versione 40 del 02/03/2011 22.45.00
Dimensione: 28414
Commento:
Le cancellazioni sono segnalate in questo modo. Le aggiunte sono segnalate in questo modo.
Linea 1: Linea 1:
##title Brand-new Universal loadeR from Grub
## try to use a title for the page which uses capitalization and spaces between words, as above

||<tablestyle="float:right; font-size: 0.9em; width:40%; background:#F1F1ED; margin: 0 0 1em 1em;" style="padding:0.5em;"><<BR>><<TableOfContents(2)>>||

= Introduction =

BURG stands for '''B'''rand-new '''U'''niversal loade'''R''' from '''G'''RUB. It's based on GRUB, and add features like new object format and configurable menu system. This page shows its usage.

= Install using binary package =

I have created a PPA package for Ubuntu Jaunty (9.04), Karmic (9.10), Lucid (10.04) and Maverick (10.10) users. To use it for example, add this line to your /etc/apt/sources.lst (Maverick) distribution:

{{{
deb http://ppa.launchpad.net/bean123ch/burg/ubuntu maverick main
deb-src http://ppa.launchpad.net/bean123ch/burg/ubuntu maverick main
}}}

Insert the correspondent GPG signature into the keyring, running these commands:
{{{
gpg --keyserver subkeys.pgp.net --recv 55708F1EE06803C5
gpg --export --armor 55708F1EE06803C5 | sudo apt-key add -
}}}

Starting with Lucid Lynx (10.04) there is a simpler way to add a repository with GPG signature by entering the following command:
{{{
sudo add-apt-repository ppa:bean123ch/burg
}}}

Then use the following command to download and install the loader, themes and emulator:
{{{
sudo apt-get update && sudo apt-get install burg
}}}

During the installation, it should ask you to write the new boot loader to MBR. If you skip that step, you can later use the following command to update MBR of hd0:
{{{
[[BR]]
[[Indice(depth=1)]]
[[BR]][[BR]]
[[Informazioni(forum="http://forum.ubuntu-it.org/index.php/topic,443984.0.html; rilasci="10.10 10.04";)]]

= Introduzione =

'''Burg''' è un bootloader derivato da '''Grub''' e consiste praticamente in una modifica di esso che aggiunge alcune funzioni tra le quali una facile gestione dei temi. In questa pagina vedremo come farlo funzionare.

= Installazione =

Installare burg è molto semplice. Basta aggiungere il ppa dando da terminale il seguente comando
{{{
sudo apt-add-repository ppa:bean123ch/burg
}}}
e aggiornare il database dei pacchetti
{{{
sudo apt-get update
}}}
ed installare il pacchetto [apt://burg burg].
{{{
sudo apt-get install burg
}}}
Per utilizzare '''Burg''' come bootloader predefinito bisogna dare il comando: {{{
Linea 39: Linea 27:
or
{{{
sudo dpkg-reconfigure burg-pc
}}}

= New Menu System =

== Usage ==

To enable the new menu system, you can download the themes from:

[[http://groups.google.com/group/burg-devel]]

There are currently three themes in the files section:

theme_default.tar.gz
Default themes, containing theme minimum, proto, ubuntu and winter

proto:
{{attachment:proto.png}}

ubuntu:
{{attachment:ubuntu.png}}

winter:
{{attachment:winter.png}}

theme_sora.tar.gz
Sora themes created by Evan Gillies, containing theme sora, sora/clean and sora/extended.

theme_chiva.tar.gz
Chiva theme created by snolice in ubuntu cn forum, containing theme chiva.

Extract them to burg directory:
{{{
cd /boot/burg
sudo tar xzf ~/theme_default.tar.gz
sudo tar xzf ~/theme_sora.tar.gz
sudo tar xzf ~/theme_chiva.tar.gz
}}}

Then edit burg config file, which should be /etc/default/burg if you are using the ubuntu ppa package. GRUB_THEME select the theme, and GRUB_GFXMODE sets screen resolution, for example:
{{{
GRUB_THEME=ubuntu
GRUB_GFXMODE=640x480
}}}

Finally, you need to generate burg.cfg with (ubuntu includes command update-burg which does exactly the same thing)
{{{
sudo burg-mkconfig -o /boot/burg/burg.cfg
}}}

If you decide to change the theme later, you need to rerun update-burg to update burg.cfg.

----

The burg.cfg for EFI mode is normally construct by hand. To enable themes, just need to append these lines at the end of burg.cfg:
{{{
set gfxmode="0x0"
set gfxfont="Unifont Regular 16"
load_config /boot/burg/ubuntu/theme.txt
menu_viewer.ext
}}}

The theme file defines the following hot keys:

 * e - edit the current command
 * t - edit the current title
 * c - open a terminal window
 * 2 - open two terminal window
 * F5 - mapped to ctrl-x, used to finish edit and save the result
 * F6 - move to next anchor, normally have the same function as TAB, but it is useful in cases where TAB is used for other function (such as term),
 * F8 - toggle between text and graphic mode
 * F9 - shutdown
 * F10 - reboot
 * ESC - return from popup window

The following sections describe the format of theme file in details.

== Basic Structure ==

The format of theme file is quite straightforward, {} is used to start a child node, and = is used to set properties, for example:

= Nuovi menù di sistema =

== Utilizzo ==

Per abilitare il menù di sistema è necessario scaricare un tema. Per farlo è possibile seguire il seguente link:

[http://groups.google.com/group/burg-devel http://groups.google.com/group/burg-devel]

Oppure è possibile installare semplicemente il pacchetto dei temi dando il comando
{{{
sudo apt-get install burg-themes burg-themes-common
}}}

Una volta installato il pacchetto contenente i temi, applicare un nuovo tema sarà semplicissimo. Basterà infatti premere il tasto '''t''' alla schermata di '''Burg''' e scegliere il tema che si preferisce dalla lista dei disponibili.

Altre opzioni che si possono richiamare alla pressione di alcuni tasti durante la schermata di '''Burg''' sono:

* '''e''' - modifica la voce presente il /boot/burg/burg.cfg riguardante il sistema operativo selezionato [[BR]]
* '''t''' - modifica il tema [[BR]]
* '''c''' - apre una finestra di terminale [[BR]]
* '''2''' - apre due finestre di terminale [[BR]]
* '''F5''' - equivalente a '''Ctrl+x''', usato per finire e salvare le modifiche [[BR]]
* '''F6''' - sposta la selezione all'elemento successivo [[BR]]
* '''F8''' - cambia da modalità grafica a modalità testuale [[BR]]
* '''F9''' - arresta [[BR]]
* '''F10''' - riavvia [[BR]]
* '''ESC''' - ritorna alla finestra di burg [[BR]]

== Struttura basa ==

Il formato dei file dei temi è molto semplice, '''{}''' è usato per determinare un blocco di istruzioni, e '''=''' è usato per settare una proprietà, ad esempio:
Linea 153: Linea 91:
The topmost element in a theme file defines a section, each section have a specific function. For example, screen section is used to define screen layout, while mapkey section defines key mappings.

There are two command to read theme file, load_config and merge_config:
Gli elementi più importanti il un file del tema si definiscono in sezioni, ogni sezione ha delle funzioni specifiche. Per esempio, la sezione screen è usata per definire il layout dello schermo, mentre la sezione mapkey definisce la mappatura della tastiera.

Ci sono due comandi per leggere i file dei temi, '''load_config''' e '''merge_config''':
Linea 160: Linea 98:
The difference between load_config and merge_config is that if a section already exists, merge_config merges the new section into existing one, while load_config replaces it.

== Data Representation ==

The theme file is supposed to work in both text and graphic mode, so there can be multiple components packed inside a single property.

=== Size ===

All properties that specify size uses the following representation:
La differenza tra load_config e merge_config è che se una sezione esiste già, merge_config utilizza le nuove sezioni più le esistenti, mentre load_config le sovrascrive.

== Rappresentazione dei dati ==

Il file del tema dovrebbe funzionare sia in modalità testuale chee grafica, quindi non può essere più componenti pacchettizzate all'interno di una singola proprietà.

=== Dimensione ===

Tutte le proprietà che specificano le dimensioni utilizzano la seguente rappresentazione:
Linea 172: Linea 110:
10 character size in text and graphic mode. In graphic mode, the size is calculated using system default font, which is set using gfxfont variable. Please note that width=1 and height=1 is not the same size in pixels. 10 è la dimensione del carattere in modalità grafice e testuale. In modalità grafica, la dimensione è calcolata usando il font predefinito del sistema, che è impostato usando la variabile gfxfont. Notare che width=1 e height=1 non è la stessa dimensione in pixel.
Linea 177: Linea 115:
The size is 10 percentage of parent widget, in both text and graphic mode. La dimensione è del 10% del widget genitore, in entrambe le modalità grafica e testuale.
Linea 182: Linea 120:
10 pixels in graphic mode, and 1 character in text mode. Either component can use the percentage notion as well, such as: 10 pixel in modalità grafica, e un carattere in modalità testuale. Ciascuna componente può usare una nozione di percentuale come:
Linea 187: Linea 125:
10 percent in graphic mode, 20 percent in text mode.

=== Color ===
10% in modalità grafica, 20% in modalità testuale.

=== Colore ===
Linea 194: Linea 132:
Red, in both text and graphic mode.

The recognized color named is as follows:

 * black, blue, green, cyan, red, magenta, brown, light-gray - can be used as foreground or background color in text mode.
 * dark-gray, light-blue, light-green, light-cyan, light-red, light-magenta, yellow, white - can only be used as foreground in text mode.
Rosso, in entrambe le modalità grafica e testuale.

Il nome del colore riconosciuto è il seguente:

 * black, blue, green, cyan, red, magenta, brown, light-gray - può essere usato come colore di primo piano o di sfondo in modalità testuale.
 * dark-gray, light-blue, light-green, light-cyan, light-red, light-magenta, yellow, white - può essere usato solo come colore di primo piano in modalità testuale.
Linea 204: Linea 142:
Foreground color is red, background color is blue, works in both text and graphic mode. Il colore di primo piano è il rosso, quello di sfondo è il blu, funzionano sia in modalità grafica che testuale.
Linea 209: Linea 147:
Use #808080 in graphic mode, foreground color red, background color blue in text mode.

Widgets become selectable if there is associated command. In this case, you may want to use different color when the widget is in selected state, this can be achieved by joining two color together with ":":
Usare #808080 in modalità grafica, colore rosso in primo piano, colore blu di sfondo in modalità testuale.

I widget diventano selezionabili se vi è associato un comando.In questo caso, si consiglia di utilizzare il colore diverso quando il widget è stato selezionato, questo può essere ottenuto unendo due colori insieme con ":":
Linea 216: Linea 154:
When the widget is selected, foreground color is light-gray, otherwise it's cyan. Background color is blue in both situation.

=== Image ===
Quando il widget è selezionato, il colore in primo piano è light-gray (grigio chiaro), altrimenti è cyan (ciano). Il colore di sfondo è blu in entrambe le situazioni.

=== Immagine ===
Linea 223: Linea 161:
Draws a blue rectangle box, in both text and graphic mode. Disegna una casella rettangolare blu, in entrambe le modalità grafica e testuale.
Linea 228: Linea 166:
Draws a blue rectangle box using fill character 'c', in both text and graphic mode.
Disegna una casella rettangolare blu, usando il carattere di riempimento 'c', in entrambe le modalità grafica e testuale.
Linea 233: Linea 170:
Draws a blue rectangle box, using unicode glyph 0x250f as fill character, in both text and graphic mode. Disegna una casella rettangolare blu, usando il glifo unicode 0x250f come carattere di riempimento, in in entrambe le modalità grafica e testuale.
Linea 238: Linea 175:
Draws image /splash.png in graphic mode, blue rectangle box in text mode, you can also specify a fill character. Disegna l'immagine /splash.png in modalità grafica,una casella rettangolare blu in modalità testuale, è possibile specificare anche un carattere di riempimento.
Linea 243: Linea 180:
Draws image /splash.png in graphic mode, nothing in text mode. Disegna l'immagine /splash.png in modalità grafica, nulla in modalità testuale.
Linea 248: Linea 185:
Same as above, but uses default scaling method and background color. Idem come sopra, ma usa il metodo di scalatura predefinito e il colore di sfondo.
Linea 253: Linea 190:
Draws blue rectangle box in text mode, nothing in graphic mode.

In the above examples, the second parameter are all empty, it specify the scaling method of images, and can use one of the following value:

 * scaling (default) - scale the image to fit the width/height of widget.
 * center - draw the image at the center
 * tiling - repeat the image until it fills the area.
 * minfit - keeps ratio scaling, it ensures the entire image is shown, but it can leave blank at top/bottom or left/right.
 * maxfit - keeps ratio scaling, it ensures no blank is left, but the image can be truncated at top/bottom or left/right.

For drawing methods that leaves blanks (center and minfit), it uses the color in third parameter as background.

Just like color, you can joined two image together using ":" to specify different image when the widget is selected.
Disegna una casella rettangolare blu in modalità testuale, nula in modalità grafica.

Negli esempi visti sopra, i secondo parametro è sempre vuoto, eso specifica il metodo di scalatura dell'immagine, e può usare un unico dei seguenti valori:

 * scaling (predefinito) - scala l'immagine in base alla larghezza / altezza del widget.
 * center - disegna l'immagine al centro
 * tiling - ripete l'immagine fino a riempire l'area.
 * minfit - mantiene il rapporto di scala, assicura l'intera immagine venga visualizzata, ma può lasciare bianco in alto / basso o destra / sinistra.
 * maxfit - mantiene il rapporto di scala, si garantisce l'assenza di bianco, ma l'immagine può essere troncata in alto / basso o destra / sinistra.

Per metodi di disegno che non lasci spazi, utilizza il colore in terzo parametro come sfondo.

Proprio come il colore, è possibile unire due immagini insieme usando ":" per specificare un'immagine diversa quando il widget è selezionata.
Linea 270: Linea 208:
== Common Properties ==

Some properties are shared by all widgets. This includes properties used by layout manger, command, anchor and class.

=== Layout manager ===
You can place a widget in one of two ways. You can set its location directly, or you can let the layout manager figure it out for you.

For absolute positioning, you can use the following properties:

 * attach_top - distance to the top border of parent
 * attach_bottom - distance to the bottom border of parent
 * attach_left - distance to the left border of parent
 * attach_right - distance to the right border of parent
 * attach_hcenter - offset from the horizontal central line
 * attach_vcenter - offset from the vertical central line

If none of the above properties are set, layout manager would try to calculate the position of widget for you. You can control its placement using these properties:

 * extend - if set to 1, extend the widget in the direction of parent.
 * valign - can be top, center, bottom or extend (default).
 * halign - can be left, center, right or extend (default).

The parent widget uses the following properties to control the placement of children:

 * direction - The direction, its value can be top_to_bottom (default), bottom_to_top, left_to_right or right_to_left.
 * space - The space left between two children.

You can also set the size of widget with these properties:

 * width - width of widget
 * height - height of widget

If one of the above properties is not set, layout manager would try to calculate the width/height for you, which is normally the minimum size to contain its children, although it can also be expanded using the extend property mentioned above.

Sometimes you want the layout manager to calculate the size for you, but you don't want the widget to because too large or too small. In this case, you can use the following properties to limit the size of auto calculated widgets:

 * min_width - minimum width of widget
 * max_width - maximum width of widget
 * min_height - minimum height of widget
 * max_height - maximum height of widget

Please note that these properties have no effect if the size is set explicitly using width/height property.
== Proprietà comuni ==

Alcune proprietà sono condivise da tutti i widget. Questo include le proprietà utilizzate dal gestore layout, comando, anchor e classi.

=== Gestore di layout ===

È possibile inserire un widget in uno dei due modi. È possibile impostare la sua posizione direttamente, oppure si può lasciare che il gestore di layout lo faccia automaticamente.

Per il posizionamento assoluto, è possibile utilizzare le seguenti proprietà:

 * attach_top - distanza dal bordo superiore del genitore
 * attach_bottom - distanza dal bordo inferiore del genitore
 * attach_left - distanza dal bordo sinistro del genitore
 * attach_right - distanza dal bordo destro del genitore
 * attach_hcenter - offset dalla linea centrale orizzontale
 * attach_vcenter - offset dalla linea centrale verticale

Se nessuna delle proprietà sopra è impostata, il gestore del layout dovrebbe provare a calcolare la posizione del widget automaticamente. E' possibile controllare la posizione usando queste proprietà:

 * extend - se impostato a 1, estende il widget nella direzione del genitore.
 * valign - può essere sopra, al centro, sotto o esteso (predefinito).
 * halign - può essere sinistra, al centro, destra o esteso (predefinito).

Il widget genitore usa le seguenti proprietà per controllare la posizione del figlio:

 * direction - La direzione, il suo valore può essere top_to_bottom (default), bottom_to_top, left_to_right or right_to_left.
 * space - Lo spazio lasciato tra due figli.

E' possibile anche impostare la dimensione del widget con queste proprietà:

 * width - larghezza del widget
 * height - altezza del widget

Se una sola delle proprietà di sopra non è impostata, il gestore del layout manager dovrebbe provare a calcolare la larghezza/altezza automaticamente, che normalmente è la dimensione minima per contenere suo figlio, altrimenti può essera anche esteso usando la proprietà extend menzionata sopra.

A volte si desidera che il gestore del layout calcoli automaticamente la dimensione,ma che il widget non sia troppo largo o troppo stretto. In questo caso, è possibile usare le seguenti proprietà per limitare la dimensione dei widget calcolata automaticamente:

 * min_width - larghezza minima del widget
 * max_width - larghezza massima del widget
 * min_height - altezza minima del widget
 * max_height - altezza massima del widget

Notare che queste proprietà non hanno effetto se al dimensione è esplicitamente impostata usando le proprietà width/height.
Linea 315: Linea 254:
The command property associate action for current widget. Once it's set, the widget become selectable, navigation keys like up/down/left/right jumps to the next widget with command property set, and enter key execute the command.

To specify multiple commands to run in this property, use '\n' as separator. For example:
{{{
La proprietà command associa un'azione al widget corrente. Una volta che è impostata, il widget diventa selezionabile, tasti di navigazione su / giù / sinistra / destra salta al widget successivo con insieme di proprietà di command, ed il tasto Invio esegue il comando.

Per specificare più comandi da avviare in questa proprietà, usare '\n' come separatore. Per esempio: {{{
Linea 323: Linea 261:
Sometime you need to group some widgets together. For example. when navigating inside a menu, you may want to loop back to the last item when using the previous key on the first item. This can be archived by setting anchor to 1 in the parent widget. Key like tab jumps to the next selectable widget in another anchor, so it can be used to switch between different menus.
A volte è necessario raggruppare insieme alcuni widget. Per esempio quando si naviga dentro un menù, può essere utile per tornare all'ultima voce quando si utilizza il tasto precedente sulla prima voce. Ciò può essere ottenuto settando gli anchor ad 1 nel widget genitore. Un tasto come Tab salta al successivo widget selezionabile in un altro anchor, quindi può essere utilizzato per passare tra i diversi menù.
Linea 326: Linea 265:
Many widgets share the same property value. For example, we need to draw a rectangle box in many occasion, such as in menu, sub menu, terminal window, etc. Instead of duplicate the same set of properties many times, we can give it a name using the class property, the real property is set in the class section.

If class property is not set, it would try to locate default properties using widget name.

Molti widget condividono lo stesso valore di proprietà. Per esempio, si ha la necessità di disegnare un box rettangolare in molte occasioni, così come in menù, sottomenù, finestra di terminale, etc. Invece di duplicare lo stesso insieme di proprietà molte volte, è possibile dare un nome utilizzando la proprietà di class, la proprietà reale è impostata nella sezione class.

Se la proprietà di class non è impostata, cercherebbe di individuare le proprietà predefinite utilizzando il nome widget.
Linea 356: Linea 296:
Widget is the basic element to construct the user interface. There are several widgets, each have a set of properties to control its behavior. I widget sono gli elementi basa che costituiscono un interfaccia utente. Ci sono vari widget, ognuno personalizzabile tramite dei settaggi.
Linea 360: Linea 300:
Panel is a container for other widgets. You can set the border for panel. There are four set of border properties, from outward to inward: Panel è un contenitore di altri widget. La sua posizione può essere settata. Ci sono quattro settaggi diversi per la posizione del pannello, dall'esterno all'interno:
Linea 366: Linea 306:
 * background - Background image. This includes the space reserved by margin_*.  * background - L'immagine di sfondo
Linea 370: Linea 310:
screen is the topmost widget. It's just like panel, but it doesn't have a external border so it only uses property margin_* and background. Screen è il widget più importante. È come un pannello, ma non ha bordi esterni quindi ha solo le proprietà relative al bordo e allo sfondo.
Linea 374: Linea 314:
Text is a widget to show single line of text. It has the following properties:

 * text - The string to show
 * gfx_text - The string to show in graphic mode, if it's not set, both text and graphic mode shows the same text.
 * color - Text color
 * font - Text font
Text è un widget che mostra una singola linea di testo. Text ha le seguenti proprietà:

 * text - La stringa da mostrare
 * gfx_text - La stringa da mostrare in modalità grafica, se non è settato, sia la modalità testuale che grafica sono uguali.
 * color - Colore del testo
 * font - Carattere del testo
Linea 383: Linea 323:
Image is a widget to show a single image, Property:

 * image - The image to show
Image è il widget che ti consente di mostrare un immagine. Proprietà:

 * image - l'immagine da mostrare
Linea 402: Linea 342:
Terminal emulator, it shares properties with edit widget. Term non è altro che un emulatore di terminale, ha le stesse proprie degli altri widget.
Linea 406: Linea 346:
Password is a single line edit widget, but unlike edit, it shows * instead of the real input character. It uses properties columns, color and font. Password è un widget composto da una sola riga di immissione testo, ma diversamente dalle normali righe, mostra il carattere '''*''' invece dei reali caratteri inseriti. Usa le proprietà columns, color e font.
Linea 410: Linea 350:
This is used to show the process bar before timeout is reached. Property:

 * color - The color of progress bar. First component is the color for passed time bar, and second component is for remaining time bar. If there is not second component, only the first bar is visible.
Questo è usato per mostrare una barra di progresso prima che il timeout sia raggiunto. Proprietà:

 * color - Il colore della progressbar. Il primo componente è il colore della barra in avanzamento, il secondo è usato per la restante parte della progressbar. Se il secondo componente viene omesso, sarà visibile la barra in un solo colore.
Linea 416: Linea 356:
Template is used to define composite component. For example: '''Template''' è usato per definire un componente composito. Per esempio:
Linea 494: Linea 434:
      }       }the text
Linea 513: Linea 453:
      }       }the text
Linea 552: Linea 492:
the text
Linea 638: Linea 578:
== User interaction ==

With the new ppa package update (2010.06.07) there is a new cool command named '''menu_read'''. it's used to enter a property from a dialog window and assign it to a variable. This template can be used for user interaction, for example, add this dialog template to theme file
== Interazione dell'utente ==

Con il nuovo aggiornamento del pacchetto del ppa (2010.06.07) c'è un nuovo comando chiamato '''menu_read'''. è usato per inserire una proprietà da finestra di dialogo ed assegnarla ad una variabile. Questo modello per l'interazione dell'utente, per esempio, aggiungere questo modello di dialogo al file di tema.
Linea 698: Linea 638:
The template above can be displayed using: Il modello di sopra può essere visualizzato usando:
Linea 703: Linea 643:
The "Old value" field display the value of variable AA, and the value of "New value" edit box will be assigned to AA when you click "OK".

== Define hot keys ==

You can use keymap section to map some key to another. This is useful in platform like EFI where keys like ctrl can't be input.

onkey section associate grub command to keys. If a key is already handled by the current widget, the command defined in onkey section is ignored. For example, inside the terminal window, c is used as input character, so the command defined in onkey is ignored.
Il campo "Old value" mostra il valore della variabile AA, e il valore dell' edit box "New value" sarà assegnato a AA quando si fa clic su "OK".

== Scorciatoie da tastiera ==

E' possibile utilizzare la sezione keymap per mappare qualche tasto per un altro. Questo è utile in piattaforme come EFI dove tasti come ctrl non possono essere di input.

la sezione onkey associa i comandi di '''Grub''' per i stasti. Se ub tasto è già gestito dal widget in corso, il comando definito nella sezione onkey section è ignorato. Per esempio, dentro una finestra di terminale, c è usato come carattere di input, così il comando definito in onkey è ignorato.
Linea 727: Linea 667:
The * at the beginning of command meaning this command is password protected, this will be explained in the next section. L'asterisco all'inizio del comando indica che questo comando è protetto da password, questo sarà spiegato al paragrafo successivo..
Linea 731: Linea 671:
To enable password protection, you need to add these commands at the beginning of grub.cfg: Per abilitare la protezione con password, aggiungere il seguente comando all'inizio del file `grub.cfg`:
Linea 738: Linea 678:
The superusers variable set super users. password command set password for individual user. With --md5 option, the password should be md5 password, otherwise it's plain text.

To generate md5 password, uses grub-mkpasswd command:
La variabile superusers imposta i super users. I comando password imposta la password for singolo utente. Con l'opzione --md5, la password deve esser la password, altrimenti è solo testo.

Per generare una passsword md5, usare il comando:
Linea 745: Linea 685:
Output: Il cui output è del tipo:
Linea 750: Linea 690:
You can also uses openssl to generate it: E' possibile usare anche il comando openssl per generarla:
Linea 755: Linea 695:
Output: Il cui output è del tipo:
Linea 760: Linea 700:
To protect certain boot items, add --users option in menuentry statement: Per proteggere certe voci di avvio, aggiungere l'opzione --users nella dichiarazione del menuentry:
Linea 767: Linea 707:
Only user1 and super users can access this boot item.

In hot key definition, you can add * at the beginning of command so that only super users can access it.
Solo user1 e i super utenti possono accedere a questa voce di avvio .

Nella definizione delle scorciatoie da tastiera, è possibile aggiungere * all'inizio del comando così che solo i super utenti possano accedervi.
Linea 773: Linea 713:
To enable save default, you first need to generate a environment file using grub-editenv: Per abilitare  save default, occorre generare un file di ambiente usando grub-editenv:
Linea 778: Linea 718:
Default location for environment file is grubenv in the grub directory, although you can overwrite it with envfile variable. Command load_env read the environment file from disk.

To enable save default for all items, you can set savedefault=1 in grub.cfg, to skip some item, adds --nosave option in menuentry statement. If you only want to save a few items, then you can skip savedefault=1, but adds --save option in items you want to save. For example:
La posizione predefinita per i file di ambiente è grubenv nella cartella di grub, anche se è possibile sovrascriverla con variabile envfile. Il comando load_env legge il file di ambiente da disco.

Per abilitare save default per tutti gli oggetti, è possibile impostare savedefault=1 in grub.cfg, per saltare qualche oggetto, aggiungere nell'istruzione del menuentry l'opzione --nosave. Se si desidera solo salvare alcuni oggetti, è possibile saltare savedefault=1, ma aggiungere l'opzione --save nell'oggetto che si desidera salvare. Per esempio:
Linea 796: Linea 736:
You also set default item using config file, for example, to boot the first item, add this line to /etc/default/grub: E' possibile impostare l'oggetto predefinito usando il file config, per esemopio, per avviare il primo oggetto, aggiungere questa linea a /etc/default/grub:
Linea 801: Linea 741:
To boot the saved item from last boot: Per avviare l'oggetto salvato dall'ultimo avvio:
Linea 806: Linea 746:
Don't forget to use grub-mkconfig/update-grub to update the real grub.cfg. Non dimenticare di usare grub-mkconfig/update-grub per aggiornare il reale `grub.cfg`.
Linea 810: Linea 750:
You can use timeout variable to enable auto boot if no key is pressed in N seconds: E' possibile utilizzare la variabile timeout per abilitare l'avvio automatico se nessun tasto è premuto in N secondi:
Linea 815: Linea 755:
If timeout is set to 0, boot immediately, although you can stop it by pressing any key at startup. In the case of timeout=0, the menu is not drawn unless auto boot process is halt.

Timeout can also be set in config file using variable GRUB_TIMEOUT.

== Menu Icon ==

To add icons to boot items, uses --class option:
Se timeout è impostato a 0, si avvierà immediatamente, altrimenti è possibile fermarlo premendo un qualsiasi tasto all'avvio. In the case of timeout=0, the menu is not drawn unless auto boot process is halt.

Timeout può essere impostato nel file config usando la variable GRUB_TIMEOUT.

== Icone del menu ==

Per aggiungere icone alle voci di boot, usare l'opzione --class:
Linea 828: Linea 768:
Then in theme file, define the image_ubuntu class: Allora nel file di tema, definire la classe image_ubuntu:
Linea 837: Linea 777:
== Default Menu ==

You can append a default menu following the items defined with menuentry. Default menu is defined in theme file using menu section:
== Menu predefinito ==

È possibile aggiungere un menu predefinito seguendo le voci definite con menuentry. Il menu predefinito è definito nel file del tema usando la sezione menu:
Linea 880: Linea 820:
Here, class property corresponds to the --class option in menuentry, users corresponds to --users, save=1/save=0 corresponds to --save and --nosave.

= PXE Dynamic Configuration =

BURG adds a new command pxecfg, which can be used to execute certain command based on current IP/MAC address.

First, write a pxe config file, whose format is quite similar to menu theme.
Qui, class corrisponde all'opzione --class nel menuentry, users corrisponde a --users, save=1/save=0 corrispondono a --save e --nosave.

= Configurazione dinamica di PXE =

'''Burg''' aggiunge un nuovo comando pxecfg, che può essere utilizzato per eseguire certi comandi in base agli attuali indirizzi IP / MAC.

Innanzitutto, scrivere un file config di pxe , il cui formato è molto simile al tema del menù.
Linea 911: Linea 851:
Use this in grub.cfg to load the config file: Usare questo in `grub.cfg` per caricare il file config:
Linea 915: Linea 855:
= See Also =

[[Grub2]] <<BR>>
[[GrubHowTo]]

= Troubleshooting =
'''Q: burg won't find a grub.cfg.'''

A: newer versions use burg.cfg

= internal Links =

= Risoluzione problemi =

'''Burg''' non troverà un `grub.cfg`.

Le versioni più recenti usano `burg.cfg`


= Ulteriori risorse =

 * [https://help.ubuntu.com/community/Burg Documento originale]

 * [http://code.google.com/p/burg/ Sito del progetto]

 * [https://launchpad.net/burg Burg su Launchpad]

 * [http://www.burgloader.com/bbs Forum di Burg]

 * [http://groups.google.com/group/burg-devel Mailing list di Burg]

 * [http://code.google.com/p/burg/wiki/Screenshots Schermate di Burg]
Linea 927: Linea 877:
CategoryBootAndPartition

= external Links =
----
Development: [[http://code.google.com/p/burg/|http://code.google.com/p/burg/]]

Ubuntu: [[https://launchpad.net/burg|https://launchpad.net/burg]]

Forum: [[http://www.burgloader.com/bbs|http://www.burgloader.com/bbs]]

Mailing list: [[http://groups.google.com/group/burg-devel|http://groups.google.com/group/burg-devel]]

Screenshots: [[http://code.google.com/p/burg/wiki/Screenshots|http://code.google.com/p/burg/wiki/Screenshots]]
CategoryHomepage

BR Indice(depth=1) BRBR Informazioni(forum="http://forum.ubuntu-it.org/index.php/topic,443984.0.html; rilasci="10.10 10.04";)

Introduzione

Burg è un bootloader derivato da Grub e consiste praticamente in una modifica di esso che aggiunge alcune funzioni tra le quali una facile gestione dei temi. In questa pagina vedremo come farlo funzionare.

Installazione

Installare burg è molto semplice. Basta aggiungere il ppa dando da terminale il seguente comando

sudo apt-add-repository ppa:bean123ch/burg

e aggiornare il database dei pacchetti

sudo apt-get update

ed installare il pacchetto [apt://burg burg].

sudo apt-get install burg

Per utilizzare Burg come bootloader predefinito bisogna dare il comando:

sudo burg-install "(hd0)"

Nuovi menù di sistema

Utilizzo

Per abilitare il menù di sistema è necessario scaricare un tema. Per farlo è possibile seguire il seguente link:

[http://groups.google.com/group/burg-devel http://groups.google.com/group/burg-devel]

Oppure è possibile installare semplicemente il pacchetto dei temi dando il comando

sudo apt-get install burg-themes burg-themes-common

Una volta installato il pacchetto contenente i temi, applicare un nuovo tema sarà semplicissimo. Basterà infatti premere il tasto t alla schermata di Burg e scegliere il tema che si preferisce dalla lista dei disponibili.

Altre opzioni che si possono richiamare alla pressione di alcuni tasti durante la schermata di Burg sono:

* e - modifica la voce presente il /boot/burg/burg.cfg riguardante il sistema operativo selezionato BR * t - modifica il tema BR * c - apre una finestra di terminale BR * 2 - apre due finestre di terminale BR * F5 - equivalente a Ctrl+x, usato per finire e salvare le modifiche BR * F6 - sposta la selezione all'elemento successivo BR * F8 - cambia da modalità grafica a modalità testuale BR * F9 - arresta BR * F10 - riavvia BR * ESC - ritorna alla finestra di burg BR

Struttura basa

Il formato dei file dei temi è molto semplice, {} è usato per determinare un blocco di istruzioni, e = è usato per settare una proprietà, ad esempio:

screen {
  panel {
    extend = 1
    valign = center
    halign = center

    panel {
      class = frame
      id = __menu__
    }
  }
  
  panel {
    id = __timeout__
    attach_bottom = 1
    width = 60%
    halign = center
    height = 1
    progressbar {
     width = 100%
     height = 100%
     color = "red:brown"
    }
  }
}

mapkey {
  f5 = ctrl-x
}

Gli elementi più importanti il un file del tema si definiscono in sezioni, ogni sezione ha delle funzioni specifiche. Per esempio, la sezione screen è usata per definire il layout dello schermo, mentre la sezione mapkey definisce la mappatura della tastiera.

Ci sono due comandi per leggere i file dei temi, load_config e merge_config:

load_config /boot/burg/default.txt

La differenza tra load_config e merge_config è che se una sezione esiste già, merge_config utilizza le nuove sezioni più le esistenti, mentre load_config le sovrascrive.

Rappresentazione dei dati

Il file del tema dovrebbe funzionare sia in modalità testuale chee grafica, quindi non può essere più componenti pacchettizzate all'interno di una singola proprietà.

Dimensione

Tutte le proprietà che specificano le dimensioni utilizzano la seguente rappresentazione:

10

10 è la dimensione del carattere in modalità grafice e testuale. In modalità grafica, la dimensione è calcolata usando il font predefinito del sistema, che è impostato usando la variabile gfxfont. Notare che width=1 e height=1 non è la stessa dimensione in pixel.

10%

La dimensione è del 10% del widget genitore, in entrambe le modalità grafica e testuale.

10/1

10 pixel in modalità grafica, e un carattere in modalità testuale. Ciascuna componente può usare una nozione di percentuale come:

10%/20%

10% in modalità grafica, 20% in modalità testuale.

Colore

red

Rosso, in entrambe le modalità grafica e testuale.

Il nome del colore riconosciuto è il seguente:

  • black, blue, green, cyan, red, magenta, brown, light-gray - può essere usato come colore di primo piano o di sfondo in modalità testuale.
  • dark-gray, light-blue, light-green, light-cyan, light-red, light-magenta, yellow, white - può essere usato solo come colore di primo piano in modalità testuale.

red/blue

Il colore di primo piano è il rosso, quello di sfondo è il blu, funzionano sia in modalità grafica che testuale.

#808080/red/blue

Usare #808080 in modalità grafica, colore rosso in primo piano, colore blu di sfondo in modalità testuale.

I widget diventano selezionabili se vi è associato un comando.In questo caso, si consiglia di utilizzare il colore diverso quando il widget è stato selezionato, questo può essere ottenuto unendo due colori insieme con ":":

cyan/blue:light-gray/blue

Quando il widget è selezionato, il colore in primo piano è light-gray (grigio chiaro), altrimenti è cyan (ciano). Il colore di sfondo è blu in entrambe le situazioni.

Immagine

,,blue,#0

Disegna una casella rettangolare blu, in entrambe le modalità grafica e testuale.

,,blue,c

Disegna una casella rettangolare blu, usando il carattere di riempimento 'c', in entrambe le modalità grafica e testuale.

,,blue,#0x250F

Disegna una casella rettangolare blu, usando il glifo unicode 0x250f come carattere di riempimento, in in entrambe le modalità grafica e testuale.

/splash.png,,blue,#0

Disegna l'immagine /splash.png in modalità grafica,una casella rettangolare blu in modalità testuale, è possibile specificare anche un carattere di riempimento.

/splash.png,,blue

Disegna l'immagine /splash.png in modalità grafica, nulla in modalità testuale.

/splash.png

Idem come sopra, ma usa il metodo di scalatura predefinito e il colore di sfondo.

none,,blue,#0

Disegna una casella rettangolare blu in modalità testuale, nula in modalità grafica.

Negli esempi visti sopra, i secondo parametro è sempre vuoto, eso specifica il metodo di scalatura dell'immagine, e può usare un unico dei seguenti valori:

  • scaling (predefinito) - scala l'immagine in base alla larghezza / altezza del widget.
  • center - disegna l'immagine al centro
  • tiling - ripete l'immagine fino a riempire l'area.
  • minfit - mantiene il rapporto di scala, assicura l'intera immagine venga visualizzata, ma può lasciare bianco in alto / basso o destra / sinistra.
  • maxfit - mantiene il rapporto di scala, si garantisce l'assenza di bianco, ma l'immagine può essere troncata in alto / basso o destra / sinistra.

Per metodi di disegno che non lasci spazi, utilizza il colore in terzo parametro come sfondo.

Proprio come il colore, è possibile unire due immagini insieme usando ":" per specificare un'immagine diversa quando il widget è selezionata.

,,cyan/blue,#0x250F:,,light-gray/blue,#0x2554

Proprietà comuni

Alcune proprietà sono condivise da tutti i widget. Questo include le proprietà utilizzate dal gestore layout, comando, anchor e classi.

Gestore di layout

È possibile inserire un widget in uno dei due modi. È possibile impostare la sua posizione direttamente, oppure si può lasciare che il gestore di layout lo faccia automaticamente.

Per il posizionamento assoluto, è possibile utilizzare le seguenti proprietà:

  • attach_top - distanza dal bordo superiore del genitore
  • attach_bottom - distanza dal bordo inferiore del genitore
  • attach_left - distanza dal bordo sinistro del genitore
  • attach_right - distanza dal bordo destro del genitore
  • attach_hcenter - offset dalla linea centrale orizzontale
  • attach_vcenter - offset dalla linea centrale verticale

Se nessuna delle proprietà sopra è impostata, il gestore del layout dovrebbe provare a calcolare la posizione del widget automaticamente. E' possibile controllare la posizione usando queste proprietà:

  • extend - se impostato a 1, estende il widget nella direzione del genitore.
  • valign - può essere sopra, al centro, sotto o esteso (predefinito).
  • halign - può essere sinistra, al centro, destra o esteso (predefinito).

Il widget genitore usa le seguenti proprietà per controllare la posizione del figlio:

  • direction - La direzione, il suo valore può essere top_to_bottom (default), bottom_to_top, left_to_right or right_to_left.
  • space - Lo spazio lasciato tra due figli.

E' possibile anche impostare la dimensione del widget con queste proprietà:

  • width - larghezza del widget
  • height - altezza del widget

Se una sola delle proprietà di sopra non è impostata, il gestore del layout manager dovrebbe provare a calcolare la larghezza/altezza automaticamente, che normalmente è la dimensione minima per contenere suo figlio, altrimenti può essera anche esteso usando la proprietà extend menzionata sopra.

A volte si desidera che il gestore del layout calcoli automaticamente la dimensione,ma che il widget non sia troppo largo o troppo stretto. In questo caso, è possibile usare le seguenti proprietà per limitare la dimensione dei widget calcolata automaticamente:

  • min_width - larghezza minima del widget
  • max_width - larghezza massima del widget
  • min_height - altezza minima del widget
  • max_height - altezza massima del widget

Notare che queste proprietà non hanno effetto se al dimensione è esplicitamente impostata usando le proprietà width/height.

Command

La proprietà command associa un'azione al widget corrente. Una volta che è impostata, il widget diventa selezionabile, tasti di navigazione su / giù / sinistra / destra salta al widget successivo con insieme di proprietà di command, ed il tasto Invio esegue il comando.

Per specificare più comandi da avviare in questa proprietà, usare '\n' come separatore. Per esempio:

command = "chainloader +1\nboot"

Anchor

A volte è necessario raggruppare insieme alcuni widget. Per esempio quando si naviga dentro un menù, può essere utile per tornare all'ultima voce quando si utilizza il tasto precedente sulla prima voce. Ciò può essere ottenuto settando gli anchor ad 1 nel widget genitore. Un tasto come Tab salta al successivo widget selezionabile in un altro anchor, quindi può essere utilizzato per passare tra i diversi menù.

Class

Molti widget condividono lo stesso valore di proprietà. Per esempio, si ha la necessità di disegnare un box rettangolare in molte occasioni, così come in menù, sottomenù, finestra di terminale, etc. Invece di duplicare lo stesso insieme di proprietà molte volte, è possibile dare un nome utilizzando la proprietà di class, la proprietà reale è impostata nella sezione class.

Se la proprietà di class non è impostata, cercherebbe di individuare le proprietà predefinite utilizzando il nome widget.

screen {
 panel { class = frame }
 panel { class = frame }
}

class {
 frame {
  top_left = ",,cyan/blue,#0x250F:,,light-gray/blue,#0x2554"
  top = ",tiling,cyan/blue,#0x2501:,,light-gray/blue,#0x2550"
  top_right = ",,cyan/blue,#0x2513:,,light-gray/blue,#0x2557"
  left = ",tiling,cyan/blue,#0x2503:,,light-gray/blue,#0x2551"
  right = ",tiling,cyan/blue,#0x2503:,,light-gray/blue,#0x2551"
  bottom_left = ",,cyan/blue,#0x2517:,,light-gray/blue,#0x255A"
  bottom = ",tiling,cyan/blue,#0x2501:,,light-gray/blue,#0x2550"
  bottom_right = ",tiling,cyan/blue,#0x251B:,,light-gray/blue,#0x255D"
 }

 screen {
  background = ":,,blue,#0"
 }
}

Widgets

I widget sono gli elementi basa che costituiscono un interfaccia utente. Ci sono vari widget, ognuno personalizzabile tramite dei settaggi.

panel

Panel è un contenitore di altri widget. La sua posizione può essere settata. Ci sono quattro settaggi diversi per la posizione del pannello, dall'esterno all'interno:

  • padding_size, padding_top, padding_bottom, padding_left, padding_right - This is the most outward layer of empty strip for panel, padding_size set the default value for all four borders, you can overwrite specific size with property like padding_top.
  • border_color, border_size, border_top, border_bottom, border_left, border_right - The second layer, consists of solid color.
  • top_left, top, top_right, left, right, bottom_left, bottom, bottom_right - The third layer, consist of 8 images.
  • margin_size, margin_top, margin_bottom, margin_left, margin_right - The most inward layer, an empty strip to prevent children widgets from getting too closed to borders,
  • background - L'immagine di sfondo

screen

Screen è il widget più importante. È come un pannello, ma non ha bordi esterni quindi ha solo le proprietà relative al bordo e allo sfondo.

text

Text è un widget che mostra una singola linea di testo. Text ha le seguenti proprietà:

  • text - La stringa da mostrare
  • gfx_text - La stringa da mostrare in modalità grafica, se non è settato, sia la modalità testuale che grafica sono uguali.
  • color - Colore del testo
  • font - Carattere del testo

image

Image è il widget che ti consente di mostrare un immagine. Proprietà:

  • image - l'immagine da mostrare

edit

Edit is a widget to show a edit box. Properties:

  • max_lines - The maximum number of lines to store. max_lines=1 means single line edit. max_lines=0 means unlimited lines. If it's not set, default value 100 is used.
  • lines - The number of lines to show in screen. This is used to calculate the height of widget, so don't mix it with height property.
  • columns - The number of columns to show in screen. This is used to calculate the width of widget, so don't mix it with width property.
  • text - The initial text. You can set multiple lines of using the \n separator.
  • color - Text color.
  • font - Text font.

In the edit widget, use ctrl-x to save the current edit and returns, ESC to cancel.

term

Term non è altro che un emulatore di terminale, ha le stesse proprietà degli altri widget.

password

Password è un widget composto da una sola riga di immissione testo, ma diversamente dalle normali righe, mostra il carattere * invece dei reali caratteri inseriti. Usa le proprietà columns, color e font.

progressbar

Questo è usato per mostrare una barra di progresso prima che il timeout sia raggiunto. Proprietà:

  • color - Il colore della progressbar. Il primo componente è il colore della barra in avanzamento, il secondo è usato per la restante parte della progressbar. Se il secondo componente viene omesso, sarà visibile la barra in un solo colore.

Template

Template è usato per definire un componente composito. Per esempio:

dialog_hello {
  panel {
    parameters = "text=text.text"
    class = frame
    text {}
  }
}

The property parameters defines the mapping between parameters and internal properties. This template accepts one parameter text, which is mapped to the text property of text widget.

Some template are used internally so they must be defined in the theme file:

  • dialog_message - shows a dialog box with single text message. Must accepts text parameter which is the content of the text.
  • dialog_password - shows a password input dialog. Must accepts username and password parameter which mapping to the username and password input text.
  • template_submenu - Template used to generate sub menus.
  • template_menuite - Template used to generate the boot menu items. Must accepts title and class parameter.

Here are the definition of these templates in the default theme file:

dialog_message {
  panel {
    parameters = "text=text.text"
    class = frame
    margin_size = 1
    margin_bottom = 0
    space = 1
    attach_hcenter = 0
    attach_vcenter = 0
    text {}
    panel {
      class = frame
      command = true
      halign = center
      margin_left = 1
      margin_right = 1
      text { text = OK }
    }
  }
}

dialog_password {
  panel {
    parameters = "username=__user__.text:password=__pass__.text"
    class = frame
    margin_size = 1
    margin_bottom = 0
    attach_hcenter = 0
    attach_vcenter = 0

    panel {
      direction = left_to_right
      space = 1
      text {
        extend = 1
        valign = center
        text = Username
      }
      panel {
        class = frame
        margin_left = 1
        margin_right = 1
        edit {
          id = __user__
          max_lines = 1
        }
      }
    }

    panel {
      direction = left_to_right
      space = 1
      text {
        extend = 1
        valign = center
        text = Password
      }the text 
      panel {
        class = frame
        margin_left = 1
        margin_right = 1
        password {
          id = __pass__
        }
      }
    }

    panel {
      class = frame
      command = true
      halign = center
      margin_left = 1
      margin_right = 1
      text {
        text = OK
      }the text 
    }
  }
}

template_submenu {
  panel {
    class = frame
  }
}

template_menuitem {
  panel {
    parameters = "class=image.class:title=text.text"
    class = select
    direction = left_to_right
    image {}
    text { valign = center }
  }
}

This theme pop up the sub menu alongside parent, if you prefer to show the sub menu full screen, you can replace template_submenu with this:

template_submenu {
  panel {
    width = 100%
    height = 100%

    panel {
      id = __child__
      class = frame
      valign = center
      halign = center
      extend = 1
    }
  }
}

the text Here, the widget with id child is the place to insert auto generated (using template_menuitem) sub menu items.

You can control the placement of popup submenu using the popup property, for example:

screen {
  panel {
   id = __menu__
   popup = left
  }
}

template_submenu {
 panel {
  class = frame
  popup = right
 }
}

The values can be:

  • left, right, top, bottom - the position of popup submenu related to the current selected widget.
  • abs - Absolute position, submenu starts at (0, 0).

The popup is not set, menu system tries to decide popup position automatically,

With template, the screen section is very simple:

screen {
  panel {
    extend = 1
    valign = center
    halign = center

    panel {
      class = frame
      id = __menu__
    }
  }

  panel {
    id = __timeout__
    attach_bottom = 1
    width = 60%
    halign = center
    height = 1
    progressbar {
      width = 100%
      height = 100%
      color = "red:brown"
    }
  }
}

The widget with id menu is the place to insert auto generated top level menu items defined with menuentry statement in grub.cfg. The widget with id timeout is used for timeout control. When auto booting is paused by key press, widget with id timeout and all its children would be hidden.

You can also use command menu_popup to create a dialog box based on templates. For example, to create a hello world message box, we can use the dialog_message template:

menu_popup dialog_message "text=Hello, World"

Command menu_edit is quite similar to menu_popup, but it uses two direction parameter assignment, it's used to implement the command edit box. First, we define the template in theme file:

dialog_edit {
  panel {
    parameters = "text=edit.text"
    class = frame
    width = 80%
    attach_hcenter = 0
    attach_vcenter = 0

    edit {
      lines = 10
    }
  }
}

Then uses this command to start the dialog box:

menu_edit dialog_edit text=command

In entry, the text parameter of the dialog box is set to the command parameter of current widget. After edit is done, we reverse the order and update the command parameter to the new text.

Interazione dell'utente

Con il nuovo aggiornamento del pacchetto del ppa (2010.06.07) c'è un nuovo comando chiamato menu_read. è usato per inserire una proprietà da finestra di dialogo ed assegnarla ad una variabile. Questo modello per l'interazione dell'utente, per esempio, aggiungere questo modello di dialogo al file di tema.

dialog_input {
  panel {
    parameters = "old_value=__old__.text:new_value=__new__.text"
    class = frame
    margin_size = 1
    margin_bottom = 0
    attach_hcenter = 0
    attach_vcenter = 0

    panel {
      direction = left_to_right
      space = 1
      text {
        extend = 1
        valign = center
        text = "Old value"
      }
      text {
        id = __old__       
      }
    }

    panel {
      direction = left_to_right
      space = 1
      text {
        extend = 1
        valign = center
        text = "New value"
      }
      panel {
        class = frame
        margin_left = 1
        margin_right = 1
        edit {
          id = __new__
          max_lines = 1
        }
      }
    }

    panel {
      class = frame
      command = "menu_read new_value AA"
      halign = center
      margin_left = 1
      margin_right = 1
      text {
        text = OK       
      }
    }
  }
}

Il modello di sopra può essere visualizzato usando:

menu_popup dialog_input old_value=${AA}

Il campo "Old value" mostra il valore della variabile AA, e il valore dell' edit box "New value" sarà assegnato a AA quando si fa clic su "OK".

Scorciatoie da tastiera

E' possibile utilizzare la sezione keymap per mappare qualche tasto per un altro. Questo è utile in piattaforme come EFI dove tasti come ctrl non possono essere di input.

la sezione onkey associa i comandi di Grub per i stasti. Se ub tasto è già gestito dal widget in corso, il comando definito nella sezione onkey section è ignorato. Per esempio, dentro una finestra di terminale, c è usato come carattere di input, così il comando definito in onkey è ignorato.

onkey {
  e = "*menu_edit dialog_edit text=command"
  t = "if menu_edit dialog_line text=title; then menu_refresh; fi"
  c = "*menu_popup term_window"
  2 = "*menu_popup two_term"
  f6 = ui_next_anchor
  f8 = menu_toggle_mode
  f9 = halt
  f10 = reboot
}

mapkey {
  f5 = ctrl-x
}

L'asterisco all'inizio del comando indica che questo comando è protetto da password, questo sarà spiegato al paragrafo successivo..

Password

Per abilitare la protezione con password, aggiungere il seguente comando all'inizio del file grub.cfg:

set superusers=admin
password --md5 admin '$1$A1tpOB3$bTHEMeIVvBbQsLZIWmJp/.'
password user1 user1

La variabile superusers imposta i super users. I comando password imposta la password for singolo utente. Con l'opzione --md5, la password deve esser la password, altrimenti è solo testo.

Per generare una passsword md5, usare il comando:

grub-mkpasswd admin

Il cui output è del tipo:

$1$A1tpOB3$bTHEMeIVvBbQsLZIWmJp/.

E' possibile usare anche il comando openssl per generarla:

openssl passwd -1 -salt 1234567 admin

Il cui output è del tipo:

$1$1234567$ergpnZu0mLdD77Dbmwjpb1

Per proteggere certe voci di avvio, aggiungere l'opzione --users nella dichiarazione del menuentry:

menuentry Item1 --users user1 {
  true
}

Solo user1 e i super utenti possono accedere a questa voce di avvio .

Nella definizione delle scorciatoie da tastiera, è possibile aggiungere * all'inizio del comando così che solo i super utenti possano accedervi.

Save default

Per abilitare save default, occorre generare un file di ambiente usando grub-editenv:

sudo grub-editenv /boot/grub/grubenv create

La posizione predefinita per i file di ambiente è grubenv nella cartella di grub, anche se è possibile sovrascriverla con variabile envfile. Il comando load_env legge il file di ambiente da disco.

Per abilitare save default per tutti gli oggetti, è possibile impostare savedefault=1 in grub.cfg, per saltare qualche oggetto, aggiungere nell'istruzione del menuentry l'opzione --nosave. Se si desidera solo salvare alcuni oggetti, è possibile saltare savedefault=1, ma aggiungere l'opzione --save nell'oggetto che si desidera salvare. Per esempio:

set envfile=/boot/grub/grubenv
set savedefault=1
load_env

menuentry Item1 --nosave {
  true
}

menuentry Item2 --save {
  true
}

E' possibile impostare l'oggetto predefinito usando il file config, per esemopio, per avviare il primo oggetto, aggiungere questa linea a /etc/default/grub:

GRUB_DEFAULT=0

Per avviare l'oggetto salvato dall'ultimo avvio:

GRUB_DEFAULT=saved

Non dimenticare di usare grub-mkconfig/update-grub per aggiornare il reale grub.cfg.

Timeout

E' possibile utilizzare la variabile timeout per abilitare l'avvio automatico se nessun tasto è premuto in N secondi:

set timeout=5

Se timeout è impostato a 0, si avvierà immediatamente, altrimenti è possibile fermarlo premendo un qualsiasi tasto all'avvio. In the case of timeout=0, the menu is not drawn unless auto boot process is halt.

Timeout può essere impostato nel file config usando la variable GRUB_TIMEOUT.

Icone del menu

Per aggiungere icone alle voci di boot, usare l'opzione --class:

menuentry Item1 --class image_ubuntu {
  true
}

Allora nel file di tema, definire la classe image_ubuntu:

class {
  image_ubuntu {
    image = "${prefix}/icons/ubuntu.png"
  }
}

È possibile aggiungere un menu predefinito seguendo le voci definite con menuentry. Il menu predefinito è definito nel file del tema usando la sezione menu:

menu {
  Tools {
    class = image_dir
    users = user
    save = 0

    "Toggle Mode" {
      class = image_tools
      command = menu_toggle_mode
    }

    "Terminal" {
      class = image_term
      command = "menu_popup term_window"
    }

    "Two Term" {
      class = image_term
      command = "menu_popup two_term"
    }

    "About" {
      class = image_about
      command = "menu_popup dialog_message \"text=This is GNU GRUB\""
    }
  }

  Shutdown {
    class = image_shutdown
    command = "halt"
  }

  Restart {
    class = image_restart
    command = "reboot"
  }
}

Qui, class corrisponde all'opzione --class nel menuentry, users corrisponde a --users, save=1/save=0 corrispondono a --save e --nosave.

Configurazione dinamica di PXE

Burg aggiunge un nuovo comando pxecfg, che può essere utilizzato per eseguire certi comandi in base agli attuali indirizzi IP / MAC.

Innanzitutto, scrivere un file config di pxe , il cui formato è molto simile al tema del menù.

ip {
  192 {
    168.2 {
      command = "echo ip 192.168.2.*"
    }

    169 {
      command = "echo ip 192.169.*.*"
    }

    command = "echo ip 192.*.*.*"
  }
}

mac {
  00-0c-29-1a {
    command = "echo mac 00-0c-29-1a-*-*"
  }

  command = "echo mac *-*-*-*-*-*"
}

Usare questo in grub.cfg per caricare il file config:

pxecfg /config.txt

Risoluzione problemi

Burg non troverà un grub.cfg.

Le versioni più recenti usano burg.cfg

Ulteriori risorse


CategoryHomepage