efibootmgr: support '-b bootXXXX' as an alias for '-b XXXX'

Sponsored by:		Netflix
This commit is contained in:
Warner Losh 2022-05-17 10:47:03 -06:00
parent 93d4bad645
commit 98d2608a2a
2 changed files with 11 additions and 2 deletions

View file

@ -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

View file

@ -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;