#!/bin/sh bootmountpoint=/mnt/boot/ echo " " mkdir $bootmountpoint ls $bootmountpoint 2>/dev/null >/dev/null if [ $? != 0 ]; then echo "Erreur dans la creation du point de montage" echo "Le programme de flashage doit quitter" echo "(verifiez d'avoir bien lancé le programme en root)" echo " " exit fi romfs_device="" img_courante="" if /bin/grep -q root=/dev/hda2 /proc/cmdline; then romfs_device="/dev/hda3" grub_entry_no=1 img_courante=0 fi if /bin/grep -q root=/dev/hda3 /proc/cmdline; then romfs_device="/dev/hda2" grub_entry_no=0 img_courante=1 fi if /bin/grep -q root=/dev/hdc2 /proc/cmdline; then romfs_device="/dev/hdc3" grub_entry_no=1 img_courante=0 fi if /bin/grep -q root=/dev/hdc3 /proc/cmdline; then romfs_device="/dev/hdc2" grub_entry_no=0 img_courante=1 fi if [ -z $romfs_device ]; then echo "Cannot find the device to erase" exit 0 fi echo " " echo "Vous etes sur l'image n° $img_courante" echo "Vous allez switcher sur l'image n° ${grub_entry_no}," echo -n "Etes vous sur de vouloir continuer ? [y/N]" read reponse if [ "$reponse" = "y" ] || [ "$reponse" = "Y" ]; then { mount /dev/hda1 "${bootmountpoint}" cat > ${bootmountpoint}/boot/grub/default <<__EOF ${grub_entry_no} 10 # # # # # # # # # # # # # WARNING: If you want to edit this file directly, do not remove any line # from this file, including this warning. Using \`grub-set-default\' is # strongly recommended. __EOF echo echo "Fini !!! Vous pouvez maintenant redemarrer votre gate." echo exit 0 } else exit 0 echo "Annulé !" fi