#!/bin/bash

if [ -f /etc/grub.d/30_os-prober ]; then
  sed -i -e 's/    linux)/    linux_disable)/' /etc/grub.d/30_os-prober
else
  echo "No existe /etc/grub.d/30_os-prober"
fi

echo "
#!/bin/sh
exec tail -n +3 \$0
### BEGIN Recuperacion ###
   menuentry \"Sistema de recuperación\" --class gnu-linux --class gnu --class os {
     insmod part_msdos
     insmod ext2
     set root='(hd0,msdos5)'
     search --no-floppy --fs-uuid --set=root 4a5d9a51-a26c-4d36-a500-bc3e6372cfb8
     linux /vmlinuz root=/dev/sda5
     initrd /initrd.img
   }
### END Recuperacion ###" > /etc/grub.d/40_conig-recovery

echo "Agregada la partición de recuperación al grub"
chmod +x /etc/grub.d/40_conig-recovery

update-grub
