foreach i in hddrv_%
do
    if (copy_pending("%i"))
    then
        error "No hard disk driver found for %i='$i', check config/hd.txt"
    fi
done

if (boot_type =~ "cd|cdemul")
then
    set cddrv_found="no"
    foreach i in hddrv_%
    do
        if ((i == "ide-cd" ) || (i == "scsi-cd"))
        then
            set cddrv_found
        fi
    done
    if (! cddrv_found)
    then
        error "if you want to boot from cdrom you have to select cdrom drivers"
    fi
fi

if (boot_type == "ls120")
then
    set idefloppy_found="no"
    foreach i in hddrv_%
    do
        if (i == "ide-floppy")
        then
            set idefloppy_found
        fi
    done
    if (! idefloppy_found)
    then
        error "if you want to boot from ls120 you have to select ide-floppy driver"
    fi
fi

if ! (opt_scp || opt_sftpserver || (start_imond == "yes"))
then
    if (opt_hdinstall)
    then
        error "you can't do a remote-update with this config! hdinstall not possible. Please enable imond, scp or any other file transfer package and read the documentation."
    else
        if (boot_type == "hd")
        then
            warning "you won't be able to remote-update with this config! Enabling imond, scp or any other file transfer package is recommended."
        fi
    fi
fi

if (opt_menu)
then
    if (boot_type == "hd")
    then
        add_to_opt "etc/menu/700-recovery" "flags=utxt"
    fi
    if (opt_hdinstall)
    then
        add_to_opt "etc/menu/700-hdinstall" "flags=utxt"
    fi
fi

if ((opt_hdinstall || opt_mount) && !opt_hddrv)
then
    error "OPT_HDDRV is set to 'no' but you should be able to access the harddisk if you like to mount a HD or want to start a hd installation!"
fi

if ((boot_type == "hd") || opt_mount)
then
    add_to_opt "rootfs:files/sbin/e2fsck" "mode=555"
fi
