#!/bin/bash bootdevice=$(mount | awk '/ \/boot / {gsub(/[0-9]/,"",$1);print $1}') rootdevice=$(mount | awk '/ \/ / {gsub(/[0-9]/,"",$1);print $1}') if [[ -n "${bootdevice}" ]] then grub-install ${bootdevice} exit $? elif [[ -n "${rootdevice}" ]] then grub-install ${rootdevice} exit $? else echo "Le disque d'installation de grub ne peut pas être déterminé." exit 127 fi