Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Oct 2023 04:04:28 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 98d2608a2a68 - main - efibootmgr: support '-b bootXXXX' as an alias for '-b XXXX'
Message-ID:  <202310270404.39R44S7e040651@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=98d2608a2a686a300fdaeb45e666ff1661244260

commit 98d2608a2a686a300fdaeb45e666ff1661244260
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-05-17 16:47:03 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-10-27 04:01:16 +0000

    efibootmgr: support '-b bootXXXX' as an alias for '-b XXXX'
    
    Sponsored by:           Netflix
---
 usr.sbin/efibootmgr/efibootmgr.8 | 7 ++++++-
 usr.sbin/efibootmgr/efibootmgr.c | 6 +++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/efibootmgr/efibootmgr.8 b/usr.sbin/efibootmgr/efibootmgr.8
index fc8da06719c5..5805b797ff5c 100644
--- a/usr.sbin/efibootmgr/efibootmgr.8
+++ b/usr.sbin/efibootmgr/efibootmgr.8
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd February 15, 2023
+.Dd October 26, 2023
 .Dt EFIBOOTMGR 8
 .Os
 .Sh NAME
@@ -115,6 +115,11 @@ When creating or modifying an entry, use
 .Ar bootnum
 as the index.
 When creating a new entry, fail if it already exists.
+For convenience, if
+.Ar bootnum
+is prefixed with
+.Dq boot ,
+that prefix is ignored.
 .It Fl B -delete
 Delete the given
 .Ar bootnum
diff --git a/usr.sbin/efibootmgr/efibootmgr.c b/usr.sbin/efibootmgr/efibootmgr.c
index 8dcf9876486d..ce7265857391 100644
--- a/usr.sbin/efibootmgr/efibootmgr.c
+++ b/usr.sbin/efibootmgr/efibootmgr.c
@@ -202,6 +202,7 @@ static void
 parse_args(int argc, char *argv[])
 {
 	int ch;
+	const char *arg;
 
 	while ((ch = getopt_long(argc, argv, "AaBb:C:cdDe:EFfhk:L:l:NnOo:pTt:v",
 		    lopts, NULL)) != -1) {
@@ -214,7 +215,10 @@ parse_args(int argc, char *argv[])
 			break;
 		case 'b':
 			opts.has_bootnum = true;
-			opts.bootnum = strtoul(optarg, NULL, 16);
+			arg = optarg;
+			if (strncasecmp(arg, "boot", 4) == 0)
+				arg += 4;
+			opts.bootnum = strtoul(arg, NULL, 16);
 			break;
 		case 'B':
 			opts.delete = true;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202310270404.39R44S7e040651>