summaryrefslogtreecommitdiffstats
path: root/sys/boot/efi/loader/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/boot/efi/loader/main.c')
-rw-r--r--sys/boot/efi/loader/main.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/boot/efi/loader/main.c b/sys/boot/efi/loader/main.c
index a90a87e..f796b4d 100644
--- a/sys/boot/efi/loader/main.c
+++ b/sys/boot/efi/loader/main.c
@@ -198,6 +198,7 @@ main(int argc, CHAR16 *argv[])
efi_setcurrdev, env_nounset);
env_setenv("loaddev", EV_VOLATILE, efi_fmtdev(&currdev), env_noset,
env_nounset);
+ init_zfs_bootenv(zfs_fmtdev(&currdev));
break;
}
#endif
@@ -504,6 +505,38 @@ command_lszfs(int argc, char *argv[])
}
return (CMD_OK);
}
+
+COMMAND_SET(reloadbe, "reloadbe", "refresh the list of ZFS Boot Environments",
+ command_reloadbe);
+
+static int
+command_reloadbe(int argc, char *argv[])
+{
+ int err;
+ char *root;
+
+ if (argc > 2) {
+ command_errmsg = "wrong number of arguments";
+ return (CMD_ERROR);
+ }
+
+ if (argc == 2) {
+ err = zfs_bootenv(argv[1]);
+ } else {
+ root = getenv("zfs_be_root");
+ if (root == NULL) {
+ return (CMD_OK);
+ }
+ err = zfs_bootenv(root);
+ }
+
+ if (err != 0) {
+ command_errmsg = strerror(err);
+ return (CMD_ERROR);
+ }
+
+ return (CMD_OK);
+}
#endif
#ifdef EFI_ZFS_BOOT
OpenPOWER on IntegriCloud