help-grub
[Top][All Lists]
Advanced

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

Re: Alternative to ${cmdpath} which returns just the device


From: Andrei Borzenkov
Subject: Re: Alternative to ${cmdpath} which returns just the device
Date: Sat, 15 Nov 2014 19:36:39 +0300

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

В Fri, 14 Nov 2014 18:15:52 -0500
SevenBits <address@hidden> пишет:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hello there,
> 
> I'm the developer of Mac Linux USB Loader and Enterprise, two
> Mac-related UEFI tools. Enterprise, one of the components, uses GRUB
> to boot Linux kernels. Since I've compiled GRUB as x86-64 and it's
> creating the image with the grub-mkstandalone command, the initial
> root from GRUB is the memdisk, accessible via the (memdisk) device.
> 
> Several months ago, I was pointed to the ${cmdpath} variable, which
> has proven very useful. However, on my setup, when booting from UEFI,
> that variable contains the device *and* the path to the folder
> containing the GRUB executable, for example:
> 
> (hd0,gp1)/efi/boot/
> 
> In 90% of cases, this is great, however, I need a way to get just the
> device GRUB was booted from, and not the path to the executable. Is
> this possible?
> 

You can use regexp command to extract device part. I.e. something like:

regexp --set bootdev '\(([^)]*)\).*' "$cmdpath"

You can then use $bootdev where device name is expected.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlRngRoACgkQR6LMutpd94z6qACfVkEqQIXzVp+X7myOd36OcRwH
u8sAn1k1iMcial1EMZZDhbl132bKlS/N
=G+9m
-----END PGP SIGNATURE-----

reply via email to

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