Changeset 3610 in MondoRescue for branches/3.2/mondo/src/common/libmondo-archive.c
- Timestamp:
- Nov 5, 2016, 6:12:23 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mondo/src/common/libmondo-archive.c
r3581 r3610 550 550 551 551 #ifdef __FreeBSD__ 552 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));552 bootdev = call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"); 553 553 if (!bootdev[0]) { 554 554 mr_free(bootdev); 555 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));555 bootdev = call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"); 556 556 } 557 557 #else 558 558 /* Linux */ 559 559 #ifdef __IA64__ 560 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));560 bootdev = call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"); 561 561 #else 562 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));562 bootdev = call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"); 563 563 #endif 564 564 if (strstr(bootdev, "/dev/cciss/")) { 565 565 mr_free(bootdev); 566 566 #ifdef __IA64__ 567 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));567 bootdev = call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1"); 568 568 #else 569 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));569 bootdev = call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1"); 570 570 #endif 571 571 } 572 572 if (!bootdev[0]) { 573 573 mr_free(bootdev); 574 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));574 bootdev = call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"); 575 575 if (strstr(bootdev, "/dev/cciss/")) { 576 576 mr_free(bootdev); 577 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));577 bootdev = call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1"); 578 578 } 579 579 } … … 620 620 if ((!does_file_exist("/boot/grub/menu.lst")) && (!does_file_exist("/boot/grub/grub.cfg")) && (!does_file_exist("/boot/grub2/grub.cfg"))) { 621 621 /* if UEFI then search under /boot/efi */ 622 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("find /boot/efi -name grub.c*"));622 tmp = call_program_and_get_last_line_of_output("find /boot/efi -name grub.c*"); 623 623 if (strstr(tmp, "grub.c") == NULL) { 624 624 mr_free(bootldr_str); 625 625 fatal_error("The de facto standard location for your boot loader's config file is /boot/grub/menu.lst, /boot/grub/grub.cfg, or /boot/grub2/grub.cfg /boot/efi/.../grub.cfg but I cannot find it there. What is wrong with your Linux distribution?"); 626 626 } 627 } 628 mr_asprintf(bootldr_ver, "%s", call_program_and_get_last_line_of_output("grub --version 2> /dev/null")); 627 mr_free(tmp); 628 } 629 bootldr_ver = call_program_and_get_last_line_of_output("grub --version 2> /dev/null"); 629 630 if (strcmp(bootldr_ver,"") ==0) { 630 631 mr_free(bootldr_ver); 631 mr_asprintf(bootldr_ver, "%s", call_program_and_get_last_line_of_output("grub2-install --version"));632 bootldr_ver = call_program_and_get_last_line_of_output("grub2-install --version"); 632 633 } 633 634 } else if (bkpinfo->boot_loader == 'E') { … … 881 882 log_to_screen("Mindi failed to create your boot+data disks."); 882 883 mr_asprintf(command, "grep 'Fatal error' %s", MINDI_LOGFILE); 883 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));884 tmp = call_program_and_get_last_line_of_output(command); 884 885 mr_free(command); 885 886 … … 1132 1133 /*@ buffers *********************************** */ 1133 1134 char *command = NULL; 1135 char *tmp = NULL; 1134 1136 char *tmpfile = NULL; 1135 1137 char *data_disks_file = NULL; … … 1138 1140 mr_asprintf(data_disks_file, "%s/all.tar.gz", bkpinfo->tmpdir); 1139 1141 1140 snprintf(g_serial_string, MAX_STR_LEN - 8, "%s", call_program_and_get_last_line_of_output("dd if=/dev/urandom bs=16 count=1 2> /dev/null | hexdump | tr -s ' ' '0' | head -n1")); 1142 tmp = call_program_and_get_last_line_of_output("dd if=/dev/urandom bs=16 count=1 2> /dev/null | hexdump | tr -s ' ' '0' | head -n1"); 1143 snprintf(g_serial_string, MAX_STR_LEN - 8, "%s", tmp); 1144 mr_free(tmp); 1141 1145 strip_spaces(g_serial_string); 1142 1146 strcat(g_serial_string, "...word."); … … 1839 1843 mr_asprintf(command, "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1", bigfile_fname); 1840 1844 log_msg(1, "command = '%s'", command); 1841 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));1845 tmp = call_program_and_get_last_line_of_output(command); 1842 1846 mr_free(command); 1843 1847 … … 2580 2584 mr_asprintf(tmp, "cat %s 2> /dev/null", szserfname); 2581 2585 mr_free(our_serial_str); 2582 mr_asprintf(our_serial_str, "%s", call_program_and_get_last_line_of_output(tmp));2586 our_serial_str = call_program_and_get_last_line_of_output(tmp); 2583 2587 mr_free(tmp); 2584 2588 // FIXME - should be able to use last_line_of_file(), surely? … … 2764 2768 mr_asprintf(command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename); 2765 2769 log_it("command = %s", command); 2766 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));2770 tmp = call_program_and_get_last_line_of_output(command); 2767 2771 mr_free(command); 2768 2772 log_it("res of it = %s", tmp);
Note:
See TracChangeset
for help on using the changeset viewer.