Author: imp
Date: Sun Sep  2 18:40:18 2018
New Revision: 338432
URL: https://svnweb.freebsd.org/changeset/base/338432

Log:
  Make -a (to make the entry active) apply to creation of a new boot
  variable.
  
  Approved by: re@ (rgrimes)
  PR: 231013
  Differential Revision:  https://reviews.freebsd.org/D16977

Modified:
  head/usr.sbin/efibootmgr/efibootmgr.c

Modified: head/usr.sbin/efibootmgr/efibootmgr.c
==============================================================================
--- head/usr.sbin/efibootmgr/efibootmgr.c       Sun Sep  2 18:29:38 2018        
(r338431)
+++ head/usr.sbin/efibootmgr/efibootmgr.c       Sun Sep  2 18:40:18 2018        
(r338432)
@@ -622,7 +622,7 @@ create_loadopt(uint8_t *buf, size_t bufmax, uint32_t a
 
 static int
 make_boot_var(const char *label, const char *loader, const char *kernel, const 
char *env, bool dry_run,
-       int bootnum)
+    int bootnum, bool activate)
 {
        struct entry *new_ent;
        uint32_t load_attrs = 0;
@@ -665,6 +665,8 @@ make_boot_var(const char *label, const char *loader, c
 
        /* don't make the new bootvar active by default, use the -a option 
later */
        load_attrs = LOAD_OPTION_CATEGORY_BOOT;
+       if (activate)
+               load_attrs |= LOAD_OPTION_ACTIVE;
        load_opt_buf = malloc(MAX_LOADOPT_LEN);
        if (load_opt_buf == NULL)
                err(1, "malloc");
@@ -915,7 +917,7 @@ main(int argc, char *argv[])
                 */
                make_boot_var(opts.label ? opts.label : "",
                    opts.loader, opts.kernel, opts.env, opts.dry_run,
-                   opts.has_bootnum ? opts.bootnum : -1);
+                   opts.has_bootnum ? opts.bootnum : -1, opts.set_active);
        else if (opts.set_active || opts.set_inactive )
                handle_activity(opts.bootnum, opts.set_active);
        else if (opts.order != NULL)
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to