Print this page
halt

*** 116,126 **** #define FMRI_STARTD_CONTRACT \ "svc:/system/svc/restarter:default/:properties/restarter/contract" #define BEADM_PROG "/usr/sbin/beadm" ! #define BOOTADM_PROG "/sbin/bootadm" #define ZONEADM_PROG "/usr/sbin/zoneadm" /* * The length of FASTBOOT_MOUNTPOINT must be less than MAXPATHLEN. */ --- 116,126 ---- #define FMRI_STARTD_CONTRACT \ "svc:/system/svc/restarter:default/:properties/restarter/contract" #define BEADM_PROG "/usr/sbin/beadm" ! #define GRUBADM_PROG "/sbin/grubadm" #define ZONEADM_PROG "/usr/sbin/zoneadm" /* * The length of FASTBOOT_MOUNTPOINT must be less than MAXPATHLEN. */
*** 941,950 **** --- 941,966 ---- st = -1; } return (st); } + static int + exec_cmd(char * invoke, char * output) + { + FILE * cmd = popen(invoke, "r"); + if (! cmd) + return 0; + fgets(output, 512, cmd); + if (! *output) { + pclose(cmd); + return 0; + } + output[strlen(output) - 2] = '\0'; + pclose(cmd); + return 1; + } + /* * Mount the specified BE. * * Upon success returns zero and copies bename string to mountpoint[] */
*** 1056,1067 **** errno = 0; entnum = strtoul(bootargs_buf, NULL, 10); rc = errno; } ! if (rc == 0 && (rc = grub_get_boot_args(&fbarg, NULL, ! entnum)) == 0) { if (strlcpy(bootargs_buf, fbarg.gba_bootargs, buf_size) >= buf_size) { grub_cleanup_boot_args(&fbarg); bcopy(bootargs_saved, bootargs_buf, buf_size); rc = E2BIG; --- 1072,1083 ---- errno = 0; entnum = strtoul(bootargs_buf, NULL, 10); rc = errno; } ! if (rc == 0 && (rc = exec_cmd("/sbin/grubadm --number -1 --get-opts", ! fbarg.gba_bootargs)) == 0) { if (strlcpy(bootargs_buf, fbarg.gba_bootargs, buf_size) >= buf_size) { grub_cleanup_boot_args(&fbarg); bcopy(bootargs_saved, bootargs_buf, buf_size); rc = E2BIG;
*** 1508,1519 **** #if defined(__i386) /* set new default entry in the GRUB entry */ if (fbarg_entnum != GRUB_ENTRY_DEFAULT) { char buf[32]; ! (void) snprintf(buf, sizeof (buf), "default=%u", fbarg_entnum); ! (void) halt_exec(BOOTADM_PROG, "set-menu", buf, NULL); } #endif /* __i386 */ /* if we're dumping, do the archive update here and don't defer it */ if (cmd == A_DUMP && zoneid == GLOBAL_ZONEID && !nosync) --- 1524,1535 ---- #if defined(__i386) /* set new default entry in the GRUB entry */ if (fbarg_entnum != GRUB_ENTRY_DEFAULT) { char buf[32]; ! (void) snprintf(buf, sizeof (buf), "--set-default %u", fbarg_entnum); ! (void) halt_exec(GRUBADM_PROG, " ", buf, NULL); } #endif /* __i386 */ /* if we're dumping, do the archive update here and don't defer it */ if (cmd == A_DUMP && zoneid == GLOBAL_ZONEID && !nosync)