Print this page
halt

@@ -116,11 +116,11 @@
 
 #define FMRI_STARTD_CONTRACT \
         "svc:/system/svc/restarter:default/:properties/restarter/contract"
 
 #define BEADM_PROG      "/usr/sbin/beadm"
-#define BOOTADM_PROG    "/sbin/bootadm"
+#define GRUBADM_PROG    "/sbin/grubadm"
 #define ZONEADM_PROG    "/usr/sbin/zoneadm"
 
 /*
  * The length of FASTBOOT_MOUNTPOINT must be less than MAXPATHLEN.
  */

@@ -941,10 +941,26 @@
                         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,12 +1072,12 @@
                         errno = 0;
                         entnum = strtoul(bootargs_buf, NULL, 10);
                         rc = errno;
                 }
 
-                if (rc == 0 && (rc = grub_get_boot_args(&fbarg, NULL,
-                    entnum)) == 0) {
+                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,12 +1524,12 @@
 
 #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);
+                (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)