Changeset 2328 in MondoRescue
- Timestamp:
- Aug 18, 2009, 3:20:42 PM (15 years ago)
- Location:
- branches/2.2.10/mondo/src/common
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-archive.c
r2327 r2328 438 438 copy_mondo_and_mindi_stuff_to_scratchdir(); // payload, too, if it exists 439 439 #if __FreeBSD__ == 5 440 strcpy(bkpinfo->kernel_path, "/boot/kernel/kernel");440 mr_asprintf(bkpinfo->kernel_path, "/boot/kernel/kernel"); 441 441 #elif __FreeBSD__ == 4 442 strcpy(bkpinfo->kernel_path, "/kernel");442 mr_asprintf(bkpinfo->kernel_path, "/kernel"); 443 443 #elif linux 444 if (figure_out_kernel_path_interactively_if_necessary 445 (bkpinfo->kernel_path)) { 446 fatal_error 447 ("Kernel not found. Please specify manually with the '-k' switch."); 444 if (figure_out_kernel_path_interactively_if_necessary(bkpinfo->kernel_path)) { 445 fatal_error("Kernel not found. Please specify manually with the '-k' switch."); 448 446 } 449 447 #else … … 1661 1659 chdir(bkpinfo->scratchdir); 1662 1660 1663 if (bkpinfo->call_before_iso [0] != '\0') {1661 if (bkpinfo->call_before_iso) { 1664 1662 mr_asprintf(message_to_screen, "Running pre-ISO call for CD#%d", g_current_media_number); 1665 1663 res = eval_call_to_make_ISO(bkpinfo->call_before_iso, destfile, g_current_media_number, MONDO_LOGFILE, message_to_screen); … … 1675 1673 } 1676 1674 1677 if (bkpinfo->call_make_iso [0] != '\0') {1675 if (bkpinfo->call_make_iso) { 1678 1676 log_msg(2, "bkpinfo->call_make_iso = %s", bkpinfo->call_make_iso); 1679 1677 mds = media_descriptor_string(bkpinfo->backup_media_type); … … 1747 1745 } 1748 1746 pause_for_N_seconds(5, "Letting DVD drive settle"); 1749 res = 1750 eval_call_to_make_ISO(bkpinfo->call_make_iso, bkpinfo->scratchdir, g_current_media_number, MONDO_LOGFILE, message_to_screen); 1747 res = eval_call_to_make_ISO(bkpinfo->call_make_iso, bkpinfo->scratchdir, g_current_media_number, MONDO_LOGFILE, message_to_screen); 1751 1748 retval += res; 1752 1749 if (!bkpinfo->please_dont_eject) { … … 1846 1843 } 1847 1844 1848 if (bkpinfo->call_burn_iso [0] != '\0') {1845 if (bkpinfo->call_burn_iso) { 1849 1846 log_msg(2, "bkpinfo->call_burn_iso = %s", bkpinfo->call_burn_iso); 1850 1847 mds = media_descriptor_string(bkpinfo->backup_media_type); … … 1852 1849 mr_free(mds); 1853 1850 pause_and_ask_for_cdr(2, &cd_is_mountable); 1854 res = 1855 eval_call_to_make_ISO(bkpinfo->call_burn_iso, 1856 destfile, g_current_media_number, 1857 MONDO_LOGFILE, message_to_screen); 1851 res = eval_call_to_make_ISO(bkpinfo->call_burn_iso, destfile, g_current_media_number, MONDO_LOGFILE, message_to_screen); 1858 1852 if (res) { 1859 1853 mr_strcat(message_to_screen, "...failed"); … … 1867 1861 } 1868 1862 1869 if (bkpinfo->call_after_iso [0] != '\0') {1863 if (bkpinfo->call_after_iso) { 1870 1864 mds = media_descriptor_string(bkpinfo->backup_media_type); 1871 1865 mr_asprintf(message_to_screen, "Running post-ISO call (%s #%d)", mds, g_current_media_number); 1872 1866 mr_free(mds); 1873 res = 1874 eval_call_to_make_ISO(bkpinfo->call_after_iso, 1875 destfile, g_current_media_number, 1876 MONDO_LOGFILE, message_to_screen); 1867 res = eval_call_to_make_ISO(bkpinfo->call_after_iso, destfile, g_current_media_number, MONDO_LOGFILE, message_to_screen); 1877 1868 if (res) { 1878 1869 mr_strcat(message_to_screen, "...failed"); -
branches/2.2.10/mondo/src/common/libmondo-cli.c
r2327 r2328 1181 1181 1182 1182 if ((flag_set['k']) && (! bkpinfo->restore_data)) { 1183 strncpy(bkpinfo->kernel_path, flag_val['k'], MAX_STR_LEN);1183 mr_asprintf(bkpinfo->kernel_path, "%s", flag_val['k']); 1184 1184 if (!strcmp(bkpinfo->kernel_path, "failsafe")) { 1185 strcpy(bkpinfo->kernel_path, "FAILSAFE");1186 }1187 if (strcmp(bkpinfo->kernel_path, "FAILSAFE")1188 1185 mr_free(bkpinfo->kernel_path); 1186 mr_asprintf(bkpinfo->kernel_path, "FAILSAFE"); 1187 } 1188 if (strcmp(bkpinfo->kernel_path, "FAILSAFE") && !does_file_exist(bkpinfo->kernel_path)) { 1189 1189 retval++; 1190 1190 log_to_screen("You specified kernel '%s', which does not exist\n", bkpinfo->kernel_path); … … 1293 1293 1294 1294 if ((flag_set['A']) && (! bkpinfo->restore_data)) { 1295 strncpy(bkpinfo->call_after_iso, flag_val['A'], MAX_STR_LEN);1295 mr_asprintf(bkpinfo->call_after_iso, "%s", flag_val['A']); 1296 1296 } 1297 1297 1298 1298 if ((flag_set['B']) && (! bkpinfo->restore_data)) { 1299 strncpy(bkpinfo->call_before_iso, flag_val['B'], MAX_STR_LEN);1299 mr_asprintf(bkpinfo->call_before_iso, "%s", flag_val['B']); 1300 1300 } 1301 1301 … … 1314 1314 # endif 1315 1315 #endif 1316 if (!strchr 1317 (BOOT_LOADER_CHARS, 1318 (bkpinfo->boot_loader = flag_val['l'][0]))) { 1319 log_msg(1, "%c? WTF is %c? I need G, L, E or R.", 1320 bkpinfo->boot_loader, bkpinfo->boot_loader); 1321 fatal_error 1322 ("Please specify GRUB, LILO, ELILO or RAW with the -l switch"); 1316 if (!strchr(BOOT_LOADER_CHARS, (bkpinfo->boot_loader = flag_val['l'][0]))) { 1317 log_msg(1, "%c? What is %c? I need G, L, E or R.", bkpinfo->boot_loader, bkpinfo->boot_loader); 1318 fatal_error("Please specify GRUB, LILO, ELILO or RAW with the -l switch"); 1323 1319 } 1324 1320 #undef BOOT_LOADER_CHARS … … 1331 1327 1332 1328 if ((flag_set['P']) && (! bkpinfo->restore_data)) { 1333 strncpy(bkpinfo->postnuke_tarball, flag_val['P'], MAX_STR_LEN); 1329 mr_free(bkpinfo->postnuke_tarball); 1330 mr_asprintf(bkpinfo->postnuke_tarball, "%s", flag_val['P']); 1334 1331 } 1335 1332 -
branches/2.2.10/mondo/src/common/libmondo-devices.c
r2327 r2328 1939 1939 #endif 1940 1940 { 1941 strcpy(bkpinfo->kernel_path, "FAILSAFE"); 1941 mr_free(bkpinfo->kernel_path); 1942 mr_asprintf(bkpinfo->kernel_path, "FAILSAFE"); 1942 1943 } 1943 1944 -
branches/2.2.10/mondo/src/common/libmondo-files.c
r2327 r2328 274 274 char *command = NULL;; 275 275 276 if (!kernel[0]) { 277 strcpy(kernel, 278 call_program_and_get_last_line_of_output 279 ("mindi --findkernel 2> /dev/null")); 276 if (kernel == NULL) { 277 mr_asprintf(kernel, "%s", call_program_and_get_last_line_of_output("mindi --findkernel 2> /dev/null")); 280 278 } 281 279 // If we didn't get anything back, check whether mindi raised a fatal error … … 294 292 log_it("Calling Mindi with kernel path of '%s'", kernel); 295 293 while (!kernel[0]) { 296 if (!ask_me_yes_or_no 297 ("Kernel not found or invalid. Choose another?")) { 294 if (!ask_me_yes_or_no("Kernel not found or invalid. Choose another?")) { 298 295 return (1); 299 296 } … … 302 299 fatal_error("Kernel not found. Please specify with the '-k' flag."); 303 300 } 304 strcpy(kernel, tmp);305 mr_free(tmp);301 mr_free(kernel); 302 kernel = tmp; 306 303 307 304 log_it("User says kernel is at %s", kernel); … … 1054 1051 mr_free(command); 1055 1052 1056 if (bkpinfo->postnuke_tarball [0]) {1053 if (bkpinfo->postnuke_tarball) { 1057 1054 mr_asprintf(command, "cp -f %s %s/post-nuke.tgz", bkpinfo->postnuke_tarball, bkpinfo->tmpdir); 1058 1055 res = run_program_and_log_output(command, FALSE); -
branches/2.2.10/mondo/src/common/libmondo-tools.c
r2327 r2328 418 418 char *tmp = NULL; 419 419 char *p = NULL; 420 char call_before_iso_user [MAX_STR_LEN] = "\0";420 char call_before_iso_user = NULL; 421 421 char *iso_dev = NULL; 422 422 char *iso_mnt = NULL; … … 529 529 return(1); 530 530 } 531 sprintf(bkpinfo->call_make_iso, 532 "%s %s -Z %s . 2>> _ERR_", 533 mondo_mkisofs_sz, 534 "", bkpinfo->media_device); 531 mr_free(bkpinfo->call_make_iso); 532 mr_asprintf(bkpinfo->call_make_iso, "%s %s -Z %s . 2>> _ERR_", mondo_mkisofs_sz, "", bkpinfo->media_device); 535 533 paranoid_free(mondo_mkisofs_sz); 536 534 } … … 544 542 mr_free(command); 545 543 } 546 log_msg(2, "call_make_iso (DVD res) is ... %s", 547 bkpinfo->call_make_iso); 544 log_msg(2, "call_make_iso (DVD res) is ... %s", bkpinfo->call_make_iso); 548 545 } // end of DVD code 549 546 … … 585 582 mr_asprintf(mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_SYSLINUX); 586 583 } 584 585 mr_free(bkpinfo->call_make_iso); 587 586 if (bkpinfo->manual_cd_tray) { 588 if (bkpinfo->call_before_iso[0] == '\0') { 589 sprintf(bkpinfo->call_before_iso, 590 "%s -o %s/"MONDO_TMPISOS" . 2>> _ERR_", 591 mondo_mkisofs_sz, bkpinfo->tmpdir); 592 } else { 593 strncpy(call_before_iso_user, bkpinfo->call_before_iso, MAX_STR_LEN); 594 sprintf (bkpinfo->call_before_iso, 595 "( %s -o %s/"MONDO_TMPISOS" . 2>> _ERR_ ; %s )", 596 mondo_mkisofs_sz, bkpinfo->tmpdir, call_before_iso_user); 587 if (bkpinfo->call_before_iso == NULL) { 588 mr_asprintf(bkpinfo->call_before_iso, "%s -o %s/"MONDO_TMPISOS" . 2>> _ERR_", mondo_mkisofs_sz, bkpinfo->tmpdir); 589 } else { 590 mr_asprintf(call_before_iso_user, "%s", bkpinfo->call_before_iso); 591 mr_free(bkpinfo->call_before_iso); 592 mr_asprintf(bkpinfo->call_before_iso, "( %s -o %s/"MONDO_TMPISOS" . 2>> _ERR_ ; %s )", mondo_mkisofs_sz, bkpinfo->tmpdir, call_before_iso_user); 593 mr_free(call_before_iso_user); 597 594 } 598 595 log_it("bkpinfo->call_before_iso = %s", bkpinfo->call_before_iso); … … 600 597 return(1); 601 598 } 602 sprintf(bkpinfo->call_make_iso, 603 "%s %s -v %s fs=4m dev=%s speed=%d %s/"MONDO_TMPISOS, 604 cdr_exe, (bkpinfo->please_dont_eject) ? " " : "-eject", 605 extra_cdrom_params, bkpinfo->media_device, 606 bkpinfo->cdrw_speed, bkpinfo->tmpdir); 599 mr_asprintf(bkpinfo->call_make_iso, "%s %s -v %s fs=4m dev=%s speed=%d %s/"MONDO_TMPISOS, cdr_exe, (bkpinfo->please_dont_eject) ? " " : "-eject", extra_cdrom_params, bkpinfo->media_device, bkpinfo->cdrw_speed, bkpinfo->tmpdir); 607 600 } else { 608 sprintf(bkpinfo->call_make_iso, 609 "%s . 2>> _ERR_ | %s %s %s fs=4m dev=%s speed=%d -", 610 mondo_mkisofs_sz, cdr_exe, 611 (bkpinfo->please_dont_eject) ? " " : "-eject", 612 extra_cdrom_params, bkpinfo->media_device, 613 bkpinfo->cdrw_speed); 601 mr_asprintf(bkpinfo->call_make_iso, "%s . 2>> _ERR_ | %s %s %s fs=4m dev=%s speed=%d -", mondo_mkisofs_sz, cdr_exe, (bkpinfo->please_dont_eject) ? " " : "-eject", extra_cdrom_params, bkpinfo->media_device, bkpinfo->cdrw_speed); 614 602 } 615 603 paranoid_free(mondo_mkisofs_sz); … … 810 798 mr_free(bkpinfo->exclude_paths); 811 799 mr_free(bkpinfo->restore_path); 800 mr_free(bkpinfo->call_before_iso); 801 mr_free(bkpinfo->call_make_iso); 802 mr_free(bkpinfo->call_burn_iso); 803 mr_free(bkpinfo->call_after_iso); 804 mr_free(bkpinfo->kernel_path); 812 805 mr_free(bkpinfo->nfs_mount); 813 806 mr_free(bkpinfo->nfs_remote_dir); 814 807 mr_free(bkpinfo->nfs_user); 808 mr_free(bkpinfo->postnuke_tarball); 815 809 816 810 /* Then free the structure */ … … 860 854 bkpinfo->exclude_paths = NULL; 861 855 bkpinfo->restore_path = NULL; 862 bkpinfo->call_before_iso [0] = '\0';863 bkpinfo->call_make_iso [0] = '\0';864 bkpinfo->call_burn_iso [0] = '\0';865 bkpinfo->call_after_iso [0] = '\0';866 bkpinfo->kernel_path [0] = '\0';856 bkpinfo->call_before_iso = NULL; 857 bkpinfo->call_make_iso = NULL; 858 bkpinfo->call_burn_iso = NULL; 859 bkpinfo->call_after_iso = NULL; 860 bkpinfo->kernel_path = NULL; 867 861 bkpinfo->nfs_mount = NULL; 868 862 bkpinfo->nfs_remote_dir = NULL; 869 863 bkpinfo->nfs_user = NULL; 870 bkpinfo->postnuke_tarball [0] = '\0';864 bkpinfo->postnuke_tarball = NULL; 871 865 bkpinfo->wipe_media_first = FALSE; 872 866 bkpinfo->differential = 0; -
branches/2.2.10/mondo/src/common/mondostructures.h
r2327 r2328 524 524 * A command to call BEFORE making an ISO image. 525 525 */ 526 char call_before_iso[MAX_STR_LEN];526 char *call_before_iso; 527 527 528 528 /** 529 529 * A command to call to make an ISO image. 530 530 */ 531 char call_make_iso[MAX_STR_LEN];531 char *call_make_iso; 532 532 533 533 /** 534 534 * A command to call to burn the ISO image. 535 535 */ 536 char call_burn_iso[MAX_STR_LEN];536 char *call_burn_iso; 537 537 538 538 /** 539 539 * A command to call AFTER making an ISO image. 540 */ 541 char call_after_iso[MAX_STR_LEN]; 540 * BERLIOS: Never initialized in code !! 541 */ 542 char *call_after_iso; 542 543 543 544 /** … … 545 546 * included with Mindi. 546 547 */ 547 char kernel_path[MAX_STR_LEN];548 char *kernel_path; 548 549 549 550 /** … … 570 571 * after nuking the system. If "", do not use a post-nuke tarball. 571 572 */ 572 char postnuke_tarball[MAX_STR_LEN];573 char *postnuke_tarball; 573 574 574 575 /**
Note:
See TracChangeset
for help on using the changeset viewer.