Print this page
libbe
ba_path->module + lost file

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libbe/common/be_utils.c
          +++ new/usr/src/lib/libbe/common/be_utils.c
↓ open down ↓ 453 lines elided ↑ open up ↑
 454  454                  goto cleanup;
 455  455          }
 456  456  
 457  457          free(pool_mntpnt);
 458  458          pool_mntpnt = NULL;
 459  459  
 460  460          while (fgets(line, BUFSIZ, menu_fp)) {
 461  461                  char *tok = NULL;
 462  462  
 463  463                  (void) strlcpy(temp_line, line, BUFSIZ);
 464      -                tok = strtok(line, BE_WHITE_SPACE);
      464 +                tok = strtok(line, "=\n");
 465  465  
 466  466                  if (tok == NULL || tok[0] == '#') {
 467  467                          continue;
 468      -                } else if (strcmp(tok, "title") == 0) {
      468 +                } else if (strcmp(tok, "entry_name") == 0) {
 469  469                          collect_lines = B_FALSE;
 470  470                          if ((tok = strtok(NULL, "\n")) == NULL)
 471  471                                  (void) strlcpy(title, "", sizeof (title));
 472  472                          else
 473  473                                  (void) strlcpy(title, tok, sizeof (title));
 474  474                          found_title = B_TRUE;
 475  475  
 476  476                          if (num_tmp_lines != 0) {
 477  477                                  for (i = 0; i < num_tmp_lines; i++) {
 478  478                                          free(tmp_entries[i]);
 479  479                                          tmp_entries[i] = NULL;
 480  480                                  }
 481  481                                  num_tmp_lines = 0;
 482  482                          }
 483      -                } else if (strcmp(tok, "bootfs") == 0) {
      483 +                } else if (strcmp(tok, "data_set") == 0) {
 484  484                          char *bootfs = strtok(NULL, BE_WHITE_SPACE);
 485  485                          found_title = B_FALSE;
 486  486                          if (bootfs == NULL)
 487  487                                  continue;
 488  488  
 489  489                          if (strcmp(bootfs, be_root_ds) == 0) {
 490  490                                  found_be = B_TRUE;
 491  491                                  break;
 492  492                          }
 493  493  
 494  494                          if (be_orig_root_ds != NULL &&
 495  495                              strcmp(bootfs, be_orig_root_ds) == 0 &&
 496  496                              !found_orig_be) {
 497  497                                  char str[BUFSIZ];
 498  498                                  found_orig_be = B_TRUE;
 499  499                                  num_lines = 0;
 500  500                                  /*
 501  501                                   * Store the new title line
 502  502                                   */
 503      -                                (void) snprintf(str, BUFSIZ, "title %s\n",
      503 +                                (void) snprintf(str, BUFSIZ, "entry_name=%s\n",
 504  504                                      description ? description : be_name);
 505  505                                  entries[num_lines] = strdup(str);
 506  506                                  num_lines++;
 507  507                                  /*
 508  508                                   * If there are any lines between the title
 509  509                                   * and the bootfs line store these. Also
 510  510                                   * free the temporary lines.
 511  511                                   */
 512  512                                  for (i = 0; i < num_tmp_lines; i++) {
 513  513                                          entries[num_lines] = tmp_entries[i];
 514  514                                          tmp_entries[i] = NULL;
 515  515                                          num_lines++;
 516  516                                  }
 517      -                                num_tmp_lines = 0;
      517 +
      518 +                                zprop_get_cbdata_t cb = { 0 };
      519 +                                zprop_source_t src;
      520 +                                char * bc = strchr(be_root_ds, '/');
      521 +                                char sguid[] = "guid";
      522 +
      523 +                                *bc = '\0';
      524 +                                cb.cb_first = B_TRUE;
      525 +                                cb.cb_sources = ZPROP_SRC_ALL;
      526 +                                cb.cb_type = ZFS_TYPE_POOL;
      527 +                                zprop_get_list(g_zfs, sguid, &cb.cb_proplist, ZFS_TYPE_POOL);
      528 +                                zpool_handle_t * z_hndl = zpool_open(g_zfs, be_root_ds);
      529 +                                *bc = '/';
      530 +                                if (z_hndl) {
      531 +                                        uint64_t guid = zpool_get_prop_int(z_hndl, cb.cb_proplist->pl_prop, &src);
      532 +                                        (void) snprintf(str, BUFSIZ, "pool_uuid=%llx\n", guid);
      533 +                                        entries[num_lines] = strdup(str);
      534 +                                        num_lines++;
      535 +                                        zpool_close(z_hndl);
      536 +                                }
      537 +num_tmp_lines = 0;
 518  538                                  /*
 519  539                                   * Store the new bootfs line.
 520  540                                   */
 521      -                                (void) snprintf(str, BUFSIZ, "bootfs %s\n",
      541 +                                (void) snprintf(str, BUFSIZ, "data_set=%s\n",
 522  542                                      be_root_ds);
 523  543                                  entries[num_lines] = strdup(str);
 524  544                                  num_lines++;
 525  545                                  collect_lines = B_TRUE;
 526  546                          }
 527  547                  } else if (found_orig_be && collect_lines) {
 528  548                          /*
 529  549                           * get the rest of the lines for the original BE and
 530  550                           * store them.
 531  551                           */
 532  552                          if (strstr(line, BE_GRUB_COMMENT) != NULL ||
 533  553                              strstr(line, "BOOTADM") != NULL)
 534  554                                  continue;
 535  555                          if (strcmp(tok, "splashimage") == 0) {
 536  556                                  entries[num_lines] =
 537  557                                      strdup("splashimage "
 538  558                                      "/boot/splashimage.xpm\n");
      559 +                        } else if ((strcmp(tok, "kernel_path") == 0) || 
      560 +                                (strcmp(tok, "module") == 0)) 
      561 +                        {
      562 +                                char * path;
      563 +                                char * st_path;
      564 +                                
      565 +                                st_path = strtok(NULL, "\n");
      566 +                                path = (char *) malloc(512);
      567 +                                strcpy(path, tok);
      568 +                                strcat(path, "=");
      569 +                                strcat(path, st_path);
      570 +                                strcat(path, "\n");
      571 +                                entries[num_lines] = path;
 539  572                          } else {
 540  573                                  entries[num_lines] = strdup(temp_line);
 541  574                          }
 542  575                          num_lines++;
 543  576                  } else if (found_title && !found_orig_be) {
 544  577                          tmp_entries[num_tmp_lines] = strdup(temp_line);
 545  578                          num_tmp_lines++;
 546  579                  }
 547  580          }
 548  581  
↓ open down ↓ 42 lines elided ↑ open up ↑
 591  624                  }
 592  625                  num_lines = 0;
 593  626  
 594  627                  /*
 595  628                   * Check to see if this system supports grub
 596  629                   */
 597  630                  if (be_has_grub())
 598  631                          (void) fprintf(menu_fp, "%s\n", BE_GRUB_COMMENT);
 599  632                  ret = BE_SUCCESS;
 600  633          } else {
 601      -                (void) fprintf(menu_fp, "title %s\n",
      634 +                zprop_get_cbdata_t cb = { 0 };
      635 +                zprop_source_t src;
      636 +                char * bc = strchr(be_root_ds, '/');
      637 +                char sguid[] = "guid";
      638 +
      639 +                (void) fprintf(menu_fp, "entry_name=%s\n",
 602  640                      description ? description : be_name);
 603      -                (void) fprintf(menu_fp, "bootfs %s\n", be_root_ds);
      641 +                *bc = '\0';
      642 +                cb.cb_first = B_TRUE;
      643 +                cb.cb_sources = ZPROP_SRC_ALL;
      644 +                cb.cb_type = ZFS_TYPE_POOL;
      645 +                zprop_get_list(g_zfs, sguid, &cb.cb_proplist, ZFS_TYPE_POOL);
      646 +                zpool_handle_t * z_hndl = zpool_open(g_zfs, be_root_ds);
      647 +                *bc = '/';
      648 +                if (z_hndl) {
      649 +                        uint64_t guid = zpool_get_prop_int(z_hndl, cb.cb_proplist->pl_prop, &src);
      650 +                        (void) fprintf(menu_fp, "pool_uuid=%llx\n", guid);
      651 +                        zpool_close(z_hndl);
      652 +                }
      653 +                (void) fprintf(menu_fp, "data_set=%s\n", be_root_ds);
 604  654  
 605  655                  /*
 606  656                   * Check to see if this system supports grub
 607  657                   */
 608  658                  if (be_has_grub()) {
 609      -                        (void) fprintf(menu_fp, "kernel$ "
 610      -                            "/platform/i86pc/kernel/$ISADIR/unix -B "
 611      -                            "$ZFS-BOOTFS\n");
 612      -                        (void) fprintf(menu_fp, "module$ "
      659 +                        (void) fprintf(menu_fp, "kernel_path="
      660 +                            "/platform/i86pc/kernel/$ISADIR/unix\n");
      661 +                        (void) fprintf(menu_fp, "kernel_options="
      662 +                            "-B $ZFS_BOOTFS,console=graphic\n");
      663 +                        (void) fprintf(menu_fp, "module="
 613  664                              "/platform/i86pc/$ISADIR/boot_archive\n");
 614  665                          (void) fprintf(menu_fp, "%s\n", BE_GRUB_COMMENT);
 615  666                  }
 616  667                  ret = BE_SUCCESS;
 617  668          }
 618  669          (void) fclose(menu_fp);
 619  670  cleanup:
 620  671          if (pool_mounted) {
 621  672                  int err = BE_SUCCESS;
 622  673                  err = be_unmount_pool(zhp, ptmp_mntpnt, orig_mntpnt);
↓ open down ↓ 159 lines elided ↑ open up ↑
 782  833                  goto cleanup;
 783  834          }
 784  835  
 785  836          while (fgets(menu_buf, BUFSIZ, menu_fp)) {
 786  837                  char tline [BUFSIZ];
 787  838                  char *tok = NULL;
 788  839  
 789  840                  (void) strlcpy(tline, menu_buf, sizeof (tline));
 790  841  
 791  842                  /* Tokenize line */
 792      -                tok = strtok(tline, BE_WHITE_SPACE);
      843 +                tok = strtok(tline, "=\n");
 793  844  
 794  845                  if (tok == NULL || tok[0] == '#') {
 795  846                          /* Found empty line or comment line */
 796  847                          if (do_buffer) {
 797  848                                  /* Buffer this line */
 798  849                                  if ((buffer = (char **)realloc(buffer,
 799  850                                      sizeof (char *)*(nlines + 1))) == NULL) {
 800  851                                          ret = BE_ERR_NOMEM;
 801  852                                          goto cleanup;
 802  853                                  }
↓ open down ↓ 1 lines elided ↑ open up ↑
 804  855                                      == NULL) {
 805  856                                          ret = BE_ERR_NOMEM;
 806  857                                          goto cleanup;
 807  858                                  }
 808  859  
 809  860                          } else if (write || strncmp(menu_buf, BE_GRUB_COMMENT,
 810  861                              strlen(BE_GRUB_COMMENT)) != 0) {
 811  862                                  /* Write this line out */
 812  863                                  (void) fputs(menu_buf, tmp_menu_fp);
 813  864                          }
 814      -                } else if (strcmp(tok, "default") == 0) {
      865 +                } else if (strcmp(tok, "default_entry") == 0) {
 815  866                          /*
 816  867                           * Record what 'default' is set to because we might
 817  868                           * need to adjust this upon deleting an entry.
 818  869                           */
 819  870                          tok = strtok(NULL, BE_WHITE_SPACE);
 820  871  
 821  872                          if (tok != NULL) {
 822  873                                  default_entry = atoi(tok);
 823  874                          }
 824  875  
 825  876                          (void) fputs(menu_buf, tmp_menu_fp);
 826      -                } else if (strcmp(tok, "title") == 0) {
      877 +                } else if (strcmp(tok, "entry_name") == 0) {
 827  878                          /*
 828  879                           * If we've reached a 'title' line and do_buffer is
 829  880                           * is true, that means we've just buffered an entire
 830  881                           * entry without finding a 'bootfs' directive.  We
 831  882                           * need to write that entry out and keep searching.
 832  883                           */
 833  884                          if (do_buffer) {
 834  885                                  for (i = 0; i < nlines; i++) {
 835  886                                          (void) fputs(buffer[i], tmp_menu_fp);
 836  887                                          free(buffer[i]);
↓ open down ↓ 15 lines elided ↑ open up ↑
 852  903                          if ((buffer = (char **)realloc(buffer,
 853  904                              sizeof (char *)*(nlines + 1))) == NULL) {
 854  905                                  ret = BE_ERR_NOMEM;
 855  906                                  goto cleanup;
 856  907                          }
 857  908                          if ((buffer[nlines++] = strdup(menu_buf)) == NULL) {
 858  909                                  ret = BE_ERR_NOMEM;
 859  910                                  goto cleanup;
 860  911                          }
 861  912  
 862      -                } else if (strcmp(tok, "bootfs") == 0) {
      913 +                } else if (strcmp(tok, "data_set") == 0) {
 863  914                          char *bootfs = NULL;
 864  915  
 865  916                          /*
 866  917                           * Found a 'bootfs' line.  See if it matches the
 867  918                           * BE we're looking for.
 868  919                           */
 869  920                          if ((bootfs = strtok(NULL, BE_WHITE_SPACE)) == NULL ||
 870  921                              strcmp(bootfs, be_root_ds) != 0) {
 871  922                                  /*
 872  923                                   * Either there's nothing after the 'bootfs'
↓ open down ↓ 140 lines elided ↑ open up ↑
1013 1064                                  goto cleanup;
1014 1065                          }
1015 1066  
1016 1067                          while (fgets(menu_buf, BUFSIZ, menu_fp)) {
1017 1068                                  char tline [BUFSIZ];
1018 1069                                  char *tok = NULL;
1019 1070  
1020 1071                                  (void) strlcpy(tline, menu_buf, sizeof (tline));
1021 1072  
1022 1073                                  /* Tokenize line */
1023      -                                tok = strtok(tline, BE_WHITE_SPACE);
     1074 +                                tok = strtok(tline, "=\n");
1024 1075  
1025 1076                                  if (tok == NULL) {
1026 1077                                          /* Found empty line, write it out */
1027 1078                                          (void) fputs(menu_buf, tmp_menu_fp);
1028      -                                } else if (strcmp(tok, "default") == 0) {
     1079 +                                } else if (strcmp(tok, "default_entry") == 0) {
1029 1080                                          /* Found the default line, adjust it */
1030 1081                                          (void) snprintf(tline, sizeof (tline),
1031      -                                            "default %d\n", default_entry);
     1082 +                                            "default_entry=%d\n", default_entry);
1032 1083  
1033 1084                                          (void) fputs(tline, tmp_menu_fp);
1034 1085                                  } else {
1035 1086                                          /* Pass through all other lines */
1036 1087                                          (void) fputs(menu_buf, tmp_menu_fp);
1037 1088                                  }
1038 1089                          }
1039 1090  
1040 1091                          (void) fclose(menu_fp);
1041 1092                          menu_fp = NULL;
↓ open down ↓ 138 lines elided ↑ open up ↑
1180 1231                  goto cleanup;
1181 1232          } else if (menu_fp == NULL) {
1182 1233                  ret = BE_ERR_NO_MENU;
1183 1234                  goto cleanup;
1184 1235          }
1185 1236  
1186 1237          free(pool_mntpnt);
1187 1238          pool_mntpnt = NULL;
1188 1239  
1189 1240          while (fgets(line, BUFSIZ, menu_fp)) {
1190      -                char *tok = strtok(line, BE_WHITE_SPACE);
     1241 +                char *tok = strtok(line, "=\n");
1191 1242  
1192 1243                  if (tok != NULL && tok[0] != '#') {
1193 1244                          if (!found_default) {
1194      -                                if (strcmp(tok, "default") == 0) {
     1245 +                                if (strcmp(tok, "default_entry") == 0) {
1195 1246                                          tok = strtok(NULL, BE_WHITE_SPACE);
1196 1247                                          if (tok != NULL) {
1197 1248                                                  default_entry = atoi(tok);
1198 1249                                                  rewind(menu_fp);
1199 1250                                                  found_default = 1;
1200 1251                                          }
1201 1252                                  }
1202 1253                                  continue;
1203 1254                          }
1204      -                        if (strcmp(tok, "title") == 0) {
     1255 +                        if (strcmp(tok, "entry_name") == 0) {
1205 1256                                  entries++;
1206 1257                          } else if (default_entry == entries - 1) {
1207      -                                if (strcmp(tok, "bootfs") == 0) {
     1258 +                                if (strcmp(tok, "data_set") == 0) {
1208 1259                                          tok = strtok(NULL, BE_WHITE_SPACE);
1209 1260                                          (void) fclose(menu_fp);
1210 1261  
1211 1262                                          if (tok == NULL) {
1212 1263                                                  ret = BE_SUCCESS;
1213 1264                                                  goto cleanup;
1214 1265                                          }
1215 1266  
1216 1267                                          if ((*def_bootfs = strdup(tok)) !=
1217 1268                                              NULL) {
↓ open down ↓ 162 lines elided ↑ open up ↑
1380 1431                  err = errno;
1381 1432                  be_print_err(gettext("be_change_grub_default: "
1382 1433                      "failed to open %s file: %s\n"),
1383 1434                      temp_grub, strerror(err));
1384 1435                  (void) close(fd);
1385 1436                  ret = errno_to_be_err(err);
1386 1437                  goto cleanup;
1387 1438          }
1388 1439  
1389 1440          while (fgets(line, BUFSIZ, grub_fp)) {
1390      -                char *tok = strtok(line, BE_WHITE_SPACE);
     1441 +                char *tok = strtok(line, "=\n");
1391 1442  
1392 1443                  if (tok == NULL || tok[0] == '#') {
1393 1444                          continue;
1394      -                } else if (strcmp(tok, "title") == 0) {
     1445 +                } else if (strcmp(tok, "entry_name") == 0) {
1395 1446                          entries++;
1396 1447                          continue;
1397      -                } else if (strcmp(tok, "bootfs") == 0) {
     1448 +                } else if (strcmp(tok, "data_set") == 0) {
1398 1449                          char *bootfs = strtok(NULL, BE_WHITE_SPACE);
1399 1450                          if (bootfs == NULL)
1400 1451                                  continue;
1401 1452  
1402 1453                          if (strcmp(bootfs, be_root_ds) == 0) {
1403 1454                                  found_default = B_TRUE;
1404 1455                                  break;
1405 1456                          }
1406 1457                  }
1407 1458          }
↓ open down ↓ 1 lines elided ↑ open up ↑
1409 1460          if (!found_default) {
1410 1461                  be_print_err(gettext("be_change_grub_default: failed "
1411 1462                      "to find entry for %s in the grub menu\n"),
1412 1463                      be_name);
1413 1464                  ret = BE_ERR_BE_NOENT;
1414 1465                  goto cleanup;
1415 1466          }
1416 1467  
1417 1468          rewind(grub_fp);
1418 1469  
     1470 +        (void) snprintf(temp_line, BUFSIZ, "default_entry=%d\n",
     1471 +            entries - 1 >= 0 ? entries - 1 : 0);
     1472 +        (void) fputs(temp_line, temp_fp);
1419 1473          while (fgets(line, BUFSIZ, grub_fp)) {
1420 1474                  char *tok = NULL;
1421 1475  
1422 1476                  (void) strncpy(temp_line, line, BUFSIZ);
1423 1477  
1424      -                if ((tok = strtok(temp_line, BE_WHITE_SPACE)) != NULL &&
1425      -                    strcmp(tok, "default") == 0) {
1426      -                        (void) snprintf(temp_line, BUFSIZ, "default %d\n",
1427      -                            entries - 1 >= 0 ? entries - 1 : 0);
1428      -                        (void) fputs(temp_line, temp_fp);
     1478 +                if ((tok = strtok(temp_line, "=\n")) != NULL &&
     1479 +                    strcmp(tok, "default_entry") == 0) {
1429 1480                  } else {
1430 1481                          (void) fputs(line, temp_fp);
1431 1482                  }
1432 1483          }
1433 1484  
1434 1485          (void) fclose(grub_fp);
1435 1486          grub_fp = NULL;
1436 1487          (void) fclose(temp_fp);
1437 1488          temp_fp = NULL;
1438 1489  
↓ open down ↓ 74 lines elided ↑ open up ↑
1513 1564          char *pool_mntpnt = NULL;
1514 1565          char *ptmp_mntpnt = NULL;
1515 1566          char *orig_mntpnt = NULL;
1516 1567          char *temp_menu = NULL;
1517 1568          FILE *menu_fp = NULL;
1518 1569          FILE *new_fp = NULL;
1519 1570          struct stat sb;
1520 1571          int temp_menu_len = 0;
1521 1572          int tmp_fd;
1522 1573          int ret = BE_SUCCESS;
     1574 +        int flag = 0;
1523 1575          int err = 0;
1524 1576          boolean_t pool_mounted = B_FALSE;
1525 1577  
1526 1578          errno = 0;
1527 1579  
1528 1580          if (boot_pool == NULL)
1529 1581                  boot_pool = be_root_pool;
1530 1582  
1531 1583          if ((zhp = zfs_open(g_zfs, be_root_pool, ZFS_TYPE_DATASET)) == NULL) {
1532 1584                  be_print_err(gettext("be_update_menu: failed to open "
↓ open down ↓ 96 lines elided ↑ open up ↑
1629 1681          }
1630 1682  
1631 1683          while (fgets(line, BUFSIZ, menu_fp)) {
1632 1684                  char tline[BUFSIZ];
1633 1685                  char new_line[BUFSIZ];
1634 1686                  char *c = NULL;
1635 1687  
1636 1688                  (void) strlcpy(tline, line, sizeof (tline));
1637 1689  
1638 1690                  /* Tokenize line */
1639      -                c = strtok(tline, BE_WHITE_SPACE);
     1691 +                c = strtok(tline, "=\n");
1640 1692  
1641 1693                  if (c == NULL) {
1642 1694                          /* Found empty line, write it out. */
1643 1695                          (void) fputs(line, new_fp);
1644 1696                  } else if (c[0] == '#') {
1645 1697                          /* Found a comment line, write it out. */
1646 1698                          (void) fputs(line, new_fp);
1647      -                } else if (strcmp(c, "title") == 0) {
     1699 +                } else if (strcmp(c, "entry_name") == 0) {
1648 1700                          char *name = NULL;
1649 1701                          char *desc = NULL;
1650 1702  
1651 1703                          /*
1652 1704                           * Found a 'title' line, parse out BE name or
1653 1705                           * the description.
1654 1706                           */
     1707 +                        flag = 0;
1655 1708                          name = strtok(NULL, BE_WHITE_SPACE);
1656 1709  
1657 1710                          if (name == NULL) {
1658 1711                                  /*
1659 1712                                   * Nothing after 'title', just push
1660 1713                                   * this line through
1661 1714                                   */
1662 1715                                  (void) fputs(line, new_fp);
1663 1716                          } else {
1664 1717                                  /*
↓ open down ↓ 3 lines elided ↑ open up ↑
1668 1721                                  desc = strtok(NULL, "\n");
1669 1722  
1670 1723                                  if (strcmp(name, be_orig_name) == 0) {
1671 1724                                          /*
1672 1725                                           * The first token of the title is
1673 1726                                           * the old BE name, replace it with
1674 1727                                           * the new one, and write it out
1675 1728                                           * along with the remainder of
1676 1729                                           * description if there is one.
1677 1730                                           */
     1731 +                                        ++flag;
1678 1732                                          if (desc) {
1679 1733                                                  (void) snprintf(new_line,
1680 1734                                                      sizeof (new_line),
1681      -                                                    "title %s %s\n",
     1735 +                                                    "entry_name=%s %s\n",
1682 1736                                                      be_new_name, desc);
1683 1737                                          } else {
1684 1738                                                  (void) snprintf(new_line,
1685 1739                                                      sizeof (new_line),
1686      -                                                    "title %s\n", be_new_name);
     1740 +                                                    "entry_name=%s\n", be_new_name);
1687 1741                                          }
1688 1742  
1689 1743                                          (void) fputs(new_line, new_fp);
1690 1744                                  } else {
1691 1745                                          (void) fputs(line, new_fp);
1692 1746                                  }
1693 1747                          }
1694      -                } else if (strcmp(c, "bootfs") == 0) {
     1748 +                } else if (strcmp(c, "data_set") == 0) {
1695 1749                          /*
1696 1750                           * Found a 'bootfs' line, parse out the BE root
1697 1751                           * dataset value.
1698 1752                           */
1699 1753                          char *root_ds = strtok(NULL, BE_WHITE_SPACE);
1700 1754  
1701 1755                          if (root_ds == NULL) {
1702 1756                                  /*
1703 1757                                   * Nothing after 'bootfs', just push
1704 1758                                   * this line through
1705 1759                                   */
1706 1760                                  (void) fputs(line, new_fp);
1707 1761                          } else {
1708 1762                                  /*
1709 1763                                   * If this bootfs is the one we're renaming,
1710 1764                                   * write out the new root dataset value
1711 1765                                   */
1712 1766                                  if (strcmp(root_ds, be_root_ds) == 0) {
     1767 +                                        ++flag;
1713 1768                                          (void) snprintf(new_line,
1714      -                                            sizeof (new_line), "bootfs %s\n",
     1769 +                                            sizeof (new_line), "data_set=%s\n",
1715 1770                                              be_new_root_ds);
1716 1771  
1717 1772                                          (void) fputs(new_line, new_fp);
1718 1773                                  } else {
1719 1774                                          (void) fputs(line, new_fp);
1720 1775                                  }
1721 1776                          }
1722 1777                  } else {
1723 1778                          /*
1724 1779                           * Found some other line we don't care
↓ open down ↓ 121 lines elided ↑ open up ↑
1846 1901                  goto cleanup;
1847 1902          } else if (menu_fp == NULL) {
1848 1903                  ret = B_FALSE;
1849 1904                  goto cleanup;
1850 1905          }
1851 1906  
1852 1907          free(rpool_mntpnt);
1853 1908          rpool_mntpnt = NULL;
1854 1909  
1855 1910          while (fgets(line, BUFSIZ, menu_fp)) {
1856      -                char *tok = strtok_r(line, BE_WHITE_SPACE, &last);
     1911 +                char *tok = strtok_r(line, "=\n", &last);
1857 1912  
1858 1913                  if (tok != NULL && tok[0] != '#') {
1859      -                        if (strcmp(tok, "bootfs") == 0) {
     1914 +                        if (strcmp(tok, "data_set") == 0) {
1860 1915                                  tok = strtok_r(last, BE_WHITE_SPACE, &last);
1861 1916                                  if (tok != NULL && strcmp(tok,
1862 1917                                      be_dataset) == 0) {
1863 1918                                          (void) fclose(menu_fp);
1864 1919                                          /*
1865 1920                                           * The entry number needs to be
1866 1921                                           * decremented here because the title
1867 1922                                           * will always be the first line for
1868 1923                                           * an entry. Because of this we'll
1869 1924                                           * always be off by one entry when we
1870 1925                                           * check for bootfs.
1871 1926                                           */
1872 1927                                          *entry = ent_num - 1;
1873 1928                                          ret = B_TRUE;
1874 1929                                          goto cleanup;
1875 1930                                  }
1876      -                        } else if (strcmp(tok, "title") == 0)
     1931 +                        } else if (strcmp(tok, "entry_name") == 0)
1877 1932                                  ent_num++;
1878 1933                  }
1879 1934          }
1880 1935  
1881 1936  cleanup:
1882 1937          if (pool_mounted) {
1883 1938                  (void) be_unmount_pool(zhp, ptmp_mntpnt, orig_mntpnt);
1884 1939                  free(orig_mntpnt);
1885 1940                  free(ptmp_mntpnt);
1886 1941          }
↓ open down ↓ 1745 lines elided ↑ open up ↑
3632 3687  
3633 3688                  if ((console = be_get_console_prop()) != NULL) {
3634 3689  
3635 3690                          /*
3636 3691                           * If console is redirected to serial line,
3637 3692                           * GRUB splash screen will not be enabled.
3638 3693                           */
3639 3694                          if (strncmp(console, "text", strlen("text")) == 0 ||
3640 3695                              strncmp(console, "graphics",
3641 3696                              strlen("graphics")) == 0) {
3642      -
     3697 +/*
3643 3698                                  (void) fprintf(temp_fp, "%s\n", BE_GRUB_SPLASH);
3644 3699                                  (void) fprintf(temp_fp, "%s\n",
3645 3700                                      BE_GRUB_FOREGROUND);
3646 3701                                  (void) fprintf(temp_fp, "%s\n",
3647 3702                                      BE_GRUB_BACKGROUND);
3648 3703                                  (void) fprintf(temp_fp, "%s\n",
3649      -                                    BE_GRUB_DEFAULT);
     3704 +                                    BE_GRUB_DEFAULT);*/
3650 3705                          } else {
3651 3706                                  be_print_err(gettext("be_create_menu: "
3652 3707                                      "console on serial line, "
3653 3708                                      "GRUB splash image will be disabled\n"));
3654 3709                          }
3655 3710                  }
3656 3711  
3657      -                (void) fprintf(temp_fp, "timeout 30\n");
     3712 +                (void) fprintf(temp_fp, "timeout=30\n");
3658 3713                  (void) fclose(temp_fp);
3659 3714  
3660 3715          } else {
3661 3716                  /*
3662 3717                   * The menu file doesn't exist so we need to create a
3663 3718                   * blank file.
3664 3719                   */
3665 3720                  FILE *temp_fp = fopen(menu_file, "w+");
3666 3721                  if (temp_fp == NULL) {
3667 3722                          *menu_fp = NULL;
↓ open down ↓ 109 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX