From: Mathieu Trudel-Lapierre <mathieu.tl@gmail.com>
To: grub-devel@gnu.org
Cc: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
Subject: [PATCH] Set a bootdrive environment variable.
Date: Tue, 26 May 2015 12:46:08 -0400 [thread overview]
Message-ID: <1432658768-4225-2-git-send-email-mathieu.trudel-lapierre@canonical.com> (raw)
In-Reply-To: <1432658768-4225-1-git-send-email-mathieu.trudel-lapierre@canonical.com>
---
grub-core/kern/main.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
index 9cad0c4..8352b6e 100644
--- a/grub-core/kern/main.c
+++ b/grub-core/kern/main.c
@@ -130,6 +130,8 @@ grub_set_prefix_and_root (void)
if (fwdevice)
{
char *cmdpath;
+ char *bootdrive = NULL;
+ char *cptr;
cmdpath = grub_xasprintf ("(%s)%s", fwdevice, fwpath ? : "");
if (cmdpath)
@@ -138,6 +140,19 @@ grub_set_prefix_and_root (void)
grub_env_export ("cmdpath");
grub_free (cmdpath);
}
+
+ cptr = grub_strrchr (fwdevice, ',');
+ if (cptr)
+ {
+ bootdrive = grub_strndup (fwdevice, cptr - fwdevice);
+ cptr++;
+ }
+ if (bootdrive)
+ {
+ grub_env_set ("bootdrive", bootdrive);
+ grub_env_export ("bootdrive");
+ grub_free (bootdrive);
+ }
}
if (prefix)
--
2.1.4
next prev parent reply other threads:[~2015-05-27 2:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-26 16:46 Mathieu Trudel-Lapierre
2015-05-26 16:46 ` Mathieu Trudel-Lapierre [this message]
2015-05-27 4:04 ` Set a bootdrive environment variable Andrei Borzenkov
2015-05-27 12:55 ` Mathieu Trudel-Lapierre
2015-05-31 6:42 ` Andrei Borzenkov
2015-06-04 15:40 ` Vladimir 'φ-coder/phcoder' Serbinenko
2015-06-05 3:58 ` Andrei Borzenkov
2015-07-06 19:44 ` Mathieu Trudel-Lapierre
2015-07-07 3:48 ` Andrei Borzenkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432658768-4225-2-git-send-email-mathieu.trudel-lapierre@canonical.com \
--to=mathieu.tl@gmail.com \
--cc=grub-devel@gnu.org \
--cc=mathieu.trudel-lapierre@canonical.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).