#!/bin/sh if [ $# != 1 ]; then echo " " echo "Usage: $0 fichier_image" echo " " exit fi image_file=$1 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="" if /bin/grep -q root=/dev/hda2 /proc/cmdline; then romfs_device="/dev/hda3" grub_entry_no=1 fi if /bin/grep -q root=/dev/hda3 /proc/cmdline; then romfs_device="/dev/hda2" grub_entry_no=0 fi if /bin/grep -q root=/dev/hdc2 /proc/cmdline; then romfs_device="/dev/hdc3" grub_entry_no=1 fi if /bin/grep -q root=/dev/hdc3 /proc/cmdline; then romfs_device="/dev/hdc2" grub_entry_no=0 fi if [ -z $romfs_device ]; then echo "Cannot find the device to erase" exit 0 fi if [ ! -w $romfs_device ]; then echo "Cannot write onto the device (${romfs_device})" exit 0 fi echo echo "Mise à jour en cours..." echo cat "${image_file}" > ${romfs_device} 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