Skip to content

Commit

Permalink
FreeBSD boot code reminder only if bootfs set
Browse files Browse the repository at this point in the history
As suggested in openzfs#12099 (and after sleeping over it), change
zpool upgrade so that a reminder to update the boot code
is only shown if the zpool in question has the bootfs
property set. This should be sufficient for the vast
majority of installations. People rolling something
else/custom are most likely aware what to do in their
setup anyway.

Signed-off-by: Michael Gmelin <grembo@FreeBSD.org>
  • Loading branch information
grembo committed May 25, 2021
1 parent 94ea556 commit b7ce803
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8889,10 +8889,15 @@ upgrade_cb(zpool_handle_t *zhp, void *arg)

if (modified_pool) {
#ifdef __FreeBSD__
(void) printf(gettext("\nIf you boot from pool '%s', "
"please also update the boot code.\nSee gptzfsboot(8) "
"and loader.efi(8) for details.\n"),
zpool_get_name(zhp));
char bootfs[ZPOOL_MAXPROPLEN];
if (zpool_get_prop(zhp, ZPOOL_PROP_BOOTFS, bootfs,
sizeof (bootfs), NULL, B_FALSE) == 0 &&
strcmp(bootfs, "-") != 0) {
(void) printf(gettext("\nPool '%s' has the bootfs "
"property set, you might need to update\nthe boot "
"code. See gptzfsboot(8) and loader.efi(8) for "
"details.\n"), zpool_get_name(zhp));
}
#else
(void) printf("\n");
#endif
Expand Down Expand Up @@ -9059,10 +9064,15 @@ upgrade_one(zpool_handle_t *zhp, void *data)

if (modified_pool) {
#ifdef __FreeBSD__
(void) printf(gettext("\nIf you boot from pool '%s', "
"please also update the boot code.\nSee gptzfsboot(8) "
"and loader.efi(8) for details.\n"),
zpool_get_name(zhp));
char bootfs[ZPOOL_MAXPROPLEN];
if (zpool_get_prop(zhp, ZPOOL_PROP_BOOTFS, bootfs,
sizeof (bootfs), NULL, B_FALSE) == 0 &&
strcmp(bootfs, "-") != 0) {
(void) printf(gettext("\nPool '%s' has the bootfs "
"property set, you might need to update\nthe boot "
"code. See gptzfsboot(8) and loader.efi(8) for "
"details.\n"), zpool_get_name(zhp));
}
#else
(void) printf("\n");
#endif
Expand Down

0 comments on commit b7ce803

Please sign in to comment.