[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Probing for the existence of a device.

From: João Ricardo Sares Teles de Matos
Subject: Probing for the existence of a device.
Date: Sat, 22 Jun 2013 22:44:53 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12

I couldn't find a reliable way to do something like this:

if drive_exists_p (hd1); then
  menuentry_to_chainload_drive (hd1)

Where the missing piece is the pseudo-command "drive_exists_p", which has a 
zero return when the device exists.

The "probe --driver" command sort of does the job, but it prints error messages 
and causes a "Press any key to continue..." prompt when the device doesn't 

The idea is having automatically (dis)appearing menu entries to chainload 
devices that may be (un)plugged, which is useful in an environment where USB 
thumb drives are frequently used as boot devices.

The test command with -e or -d doesn't work unless the device contains a 
filesystem that GRUB can read.

Am I missing something, or is this something that can't be done without 
extending GRUB?

By the way, is this sort of message appropriate for this mailing list?
I'd hate to be spamming the list with offtopic queries.

João Ricardo Sares Teles de Matos

Administração de Sistemas da Rede das Novas Licenciaturas
Instituto Superior Técnico

email: address@hidden
telefone: +351 218 41 77 71

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]