logo Debian Debian Debian-France Debian-Facile Debian-fr.org Forum-Debian.fr Debian ? Communautés logo inclusivité

Debian-facile

Bienvenue sur Debian-Facile, site d'aide pour les nouveaux utilisateurs de Debian.

Vous n'êtes pas identifié(e).


L'icône rouge permet de télécharger chaque page du wiki visitée au format PDF et la grise au format ODT → ODT PDF Export

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
doc:systeme:grub-legacy:script-redemarrage [30/01/2010 08:09]
smolski
doc:systeme:grub-legacy:script-redemarrage [17/01/2016 19:52]
smolski
Ligne 1: Ligne 1:
 +====== 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 :
 +
 +<code root>​nano /​boot/​grub/​menu.lst</​code>​
 +<​code>​
 +.../...
 +    ## ## 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
 +</​code>​
 +
 +===== Modification du menu.lst =====
 +
 +On veut que **grub-set-default** fonctionne avec l'​entrée choisie. \\ 
 +Dans le menu.lst. sous root, on écrit :
 +
 +<code root>​nano /​boot/​grub/​menu.lst</​code>​
 +
 +et l'on écrit :
 +
 +<​code>​
 +.../...
 +## 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.
 +</​code>​
 +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 :
 +
 +<​code>​
 +    # 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
 +</​code>​
 +
 +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 :
 +
 +<code root>​nano /​usr/​local/​bin/​bootstable</​code>​
 +   
 +On rédige et sauve le fichier **bootstable** ainsi :
 +
 +<code bash>
 +    #!/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
 +</​code>​
 +
 +===== Script - Lancement =====
 +
 +On active le script ainsi :
 +
 +<code root>​chmod +x /​usr/​local/​bin/​bootstable</​code>​
 +
 +On lancera ce script dans un terminal avec [[:​doc:​systeme:​sudo|Sudo]] ainsi :
 +
 +<code user>​sudo /​usr/​local/​bin/​bootstable</​code>​
 +
 +Hop ! //Merci à phlinux pour cette jolie combine...//​ :-D
doc/systeme/grub-legacy/script-redemarrage.txt · Dernière modification: 17/01/2016 19:52 par smolski

Pied de page des forums

Propulsé par FluxBB