====== Script Grub - Redémarrage rapide ====== Un truc pour se simplifier la vie de fainéant qu'on mène ! \\ //Pfff ! Même plus besoin de choisir son reboot dans le menu.lst !// ;-) ===== menu.lst - Edition ===== Edition du **menu.lst** de référence : nano /boot/grub/menu.lst .../... ## ## End Default Options ## title Debian GNU/Linux, kernel 2.6.32-rc8-686 root (hd0,6) kernel /vmlinuz-2.6.32-rc8-686 root=/dev/hda5 ro initrd /initrd.img-2.6.32-rc8-686 title Debian GNU/Linux, kernel 2.6.32-rc8-686 (single-user mode) root (hd0,6) kernel /vmlinuz-2.6.32-rc8-686 root=/dev/hda5 ro single initrd /initrd.img-2.6.32-rc8-686 title Debian GNU/Linux, kernel 2.6.30-2-686 root (hd0,6) kernel /vmlinuz-2.6.30-2-686 root=/dev/hda5 ro initrd /initrd.img-2.6.30-2-686 title Debian GNU/Linux, kernel 2.6.30-2-686 (single-user mode) root (hd0,6) kernel /vmlinuz-2.6.30-2-686 root=/dev/hda5 ro single initrd /initrd.img-2.6.30-2-686 ### END DEBIAN AUTOMAGIC KERNELS LIST # This is a divider, added to separate the menu items below from the Debian # ones. title Other operating systems: root # This entry automatically added by the Debian installer for a non-linux OS # on /dev/hdb1 title Windows 95/98/Me root (hd1,0) savedefault 0 makeactive map (hd0) (hd1) map (hd1) (hd0) chainloader +1 # This entry automatically added by the Debian installer for an existing # linux installation on /dev/hdb4. title Debian Stable hdb4 root (hd1,3) chainloader +1 # kernel /boot/vmlinuz-2.6.26-1-686 root=/dev/hdb4 ro # initrd /boot/initrd.img-2.6.26-1-686 savedefault 0 boot ===== Modification du menu.lst ===== On veut que **grub-set-default** fonctionne avec l'entrée choisie. \\ Dans le menu.lst. sous root, on écrit : nano /boot/grub/menu.lst et l'on écrit : .../... ## default num # Set the default entry to the entry number NUM. Numbering starts from 0, and # the entry number 0 is the default if the command is not used. # # You can specify 'saved' instead of a number. In this case, the default entry # is the entry saved with the command 'savedefault'. # WARNING: If you are using dmraid do not change this entry to 'saved' or your # array will desync and will not let you boot your system. On modifie cette ligne : default 0 En : default saved Lors d'un prochain redémarrage on veut revenir à l'entrée par défaut (en général la première) donc dans les entrées que l'on choisi de rebooter, par exemple celle-ci : # This entry automatically added by the Debian installer for an existing # linux installation on /dev/hdb4. title Debian Stable hdb4 root (hd1,3) chainloader +1 # kernel /boot/vmlinuz-2.6.26-1-686 root=/dev/hdb4 ro # initrd /boot/initrd.img-2.6.26-1-686 On ajoute à la fin : savedefault 0 boot (Voir le **menu.lst** mis en exemple.) ===== Script - Edition ===== Ensuite on crée 1 petit script par entrée de rebootage. \\ Perso je les pose dans /usr/local/bin (vérifier qu'on a les droits pour ce repertoire). \\ Editer : nano /usr/local/bin/bootstable On rédige et sauve le fichier **bootstable** ainsi : #!/bin/bash grub-set-default 6 #le 6 c'est pour "Stable" la 6éme entrée (ou title) du menu.lst shutdown -r now ===== Script - Lancement ===== On active le script ainsi : chmod +x /usr/local/bin/bootstable On lancera ce script dans un terminal avec [[:doc:systeme:sudo|Sudo]] ainsi : sudo /usr/local/bin/bootstable Hop ! //Merci à phlinux pour cette jolie combine...// :-D