function scan_disk { # Scan the disk and create a menuentry to boot it if it contains a linux # install disk=$1 if [ -e $disk/etc/lsb-release ]; then probe -s uuid -u $disk source $disk/etc/lsb-release menuentry "$DISTRIB_ID $DISTRIB_RELEASE $disk" $disk $uuid { set root=$2 linux /vmlinuz root=UUID=$3 initrd /initrd.img } fi } # Load modules insmod all_video insmod gfxterm insmod png insmod regexp insmod part_gpt insmod part_msdos # Set up display set gfxmode=auto terminal_output gfxterm terminal_input console # Try to set up serial serial --unit=0 --speed=9600 terminal_output --append serial terminal_input --append serial # Set up appearance background_image /boot/grub/splash.png loadfont /boot/grub/unicode.pf2 # Scan all disks except for current root for disk in (*); do if [ "$disk" != "(${root})" ]; then scan_disk $disk fi done # Create menuentry for installer menuentry "Boot Installer - Graphical Console" { linux /vmlinuz ip=dhcp ro root=LABEL=cloudimg-rootfs overlayroot=tmpfs net.ifnames=0 console=ttyS0 console=tty0 quiet splash initrd /initrd.img } menuentry "Boot Installer - Serial Console" { linux /vmlinuz ip=dhcp ro root=LABEL=cloudimg-rootfs overlayroot=tmpfs net.ifnames=0 console=tty0 console=ttyS0 initrd /initrd.img } set default=0 set timeout=50