В Sat, 22 Jun 2013 22:44:53 +0100 João Ricardo Sares Teles de Matos <[email protected]> пишет:
> I couldn't find a reliable way to do something like this: > > if drive_exists_p (hd1); then > menuentry_to_chainload_drive (hd1) > fi > > 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 exist. > I cannot reproduce it, at least using current trunk. probe command simply fails without any "Press any key ...". > 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. > I think in this case search would be more useful. You cannot predict device names, but using something like search --set usb1 --fs-uuid XXXX search --set usb2 --fs-uuid XXXX ... if [ -n "$usb1" ]; then ... code to deal with USB media 1 fi ... etc ... Would allow you to quite reliably detect presence of 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. >
signature.asc
Description: PGP signature
_______________________________________________ Help-grub mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-grub
