Mercurial > illumos > illumos-gate
changeset 3449:c2c0aae5b57d
6515496 bootadm installs wrong failsafe entry
author | rscott |
---|---|
date | Fri, 19 Jan 2007 19:54:23 -0800 |
parents | aaf16568054b |
children | 48735021490d |
files | usr/src/cmd/boot/bootadm/bootadm.c usr/src/cmd/boot/bootadm/message.h |
diffstat | 2 files changed, 24 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/boot/bootadm/bootadm.c Fri Jan 19 16:59:38 2007 -0800 +++ b/usr/src/cmd/boot/bootadm/bootadm.c Fri Jan 19 19:54:23 2007 -0800 @@ -3283,7 +3283,7 @@ { FILE *fp; int entry; - char *grubdisk, *title, *osdev, *osroot; + char *grubdisk, *title, *osdev, *osroot, *failsafe_kernel = NULL; struct stat sbuf; char failsafe[256]; @@ -3323,10 +3323,25 @@ /* add the entry for failsafe archive */ (void) snprintf(failsafe, sizeof (failsafe), "%s%s", osroot, MINIROOT); if (stat(failsafe, &sbuf) == 0) { - (void) update_boot_entry(mp, FAILSAFE_TITLE, grubdisk, - (bam_direct == BAM_DIRECT_DBOOT) ? - DIRECT_BOOT_FAILSAFE_LINE : MULTI_BOOT_FAILSAFE_LINE, - MINIROOT, osroot == menu_root); + + /* Figure out where the kernel line should point */ + (void) snprintf(failsafe, sizeof (failsafe), "%s%s", osroot, + DIRECT_BOOT_FAILSAFE_KERNEL); + if (stat(failsafe, &sbuf) == 0) { + failsafe_kernel = DIRECT_BOOT_FAILSAFE_LINE; + } else { + (void) snprintf(failsafe, sizeof (failsafe), "%s%s", + osroot, MULTI_BOOT_FAILSAFE); + if (stat(failsafe, &sbuf) == 0) { + failsafe_kernel = MULTI_BOOT_FAILSAFE_LINE; + } + } + if (failsafe_kernel != NULL) { + (void) update_boot_entry(mp, FAILSAFE_TITLE, grubdisk, + failsafe_kernel, MINIROOT, osroot == menu_root); + } else { + bam_error(NO_FAILSAFE_KERNEL); + } } free(grubdisk);
--- a/usr/src/cmd/boot/bootadm/message.h Fri Jan 19 16:59:38 2007 -0800 +++ b/usr/src/cmd/boot/bootadm/message.h Fri Jan 19 19:54:23 2007 -0800 @@ -365,6 +365,10 @@ gettext("bootadm -m upgrade run, but the failsafe archives have not been\n\ updated. Not updating line %d\n") +#define NO_FAILSAFE_KERNEL \ +gettext("Could not find failsafe kernel -- no failsafe entry will be\n\ +installed in /boot/grub/menu.lst\n") + #ifdef __cplusplus } #endif