Changeset 2937 in MondoRescue for branches/3.1/mondo
- Timestamp:
- Jan 28, 2012, 1:51:28 AM (12 years ago)
- Location:
- branches/3.1/mondo/src
- Files:
-
- 20 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.1/mondo/src/common/libmondo-archive.c
r2850 r2937 483 483 * - @c compression_level 484 484 * - @c differential 485 * - @c exclude_paths486 485 * - @c image_devs 487 486 * - @c kernel_path … … 610 609 611 610 if (!bkpinfo->nonbootable_backup && (bkpinfo->boot_loader == '\0' || bkpinfo->boot_device == NULL)) { 611 update_evalcall_form(2); 612 612 613 613 #ifdef __FreeBSD__ … … 782 782 mr_free(command); 783 783 log_msg(1, "lines_in_filelist = %ld", lines_in_filelist); 784 update_evalcall_form(3); 784 785 785 786 /* 1 2 3 4 5 6 7 8 9 10 */ … … 832 833 833 834 mvaddstr_and_log_it(g_currentY, 0, "Calling MINDI to create boot+data disks"); 835 open_evalcall_form("Calling MINDI to create boot+data disks"); 834 836 res = run_external_binary_with_percentage_indicator_NEW("Generating boot+data disks", command); 837 update_evalcall_form(99); 835 838 paranoid_free(command); 836 839 … … 874 877 mr_free(tmp); 875 878 } 879 close_evalcall_form(); 876 880 return (res); 877 881 } … … 1471 1475 log_msg(2, "make_usb_fs --- scratchdir=%s", bkpinfo->scratchdir); 1472 1476 (void) getcwd(old_pwd, MAX_STR_LEN - 1); 1473 mr_asprintf(tmp, "chmod 7 55%s", bkpinfo->scratchdir);1477 mr_asprintf(tmp, "chmod 700 %s", bkpinfo->scratchdir); 1474 1478 run_program_and_log_output(tmp, FALSE); 1475 1479 mr_free(tmp); … … 1499 1503 run_program_and_log_output(tmp, FALSE); 1500 1504 mr_free(tmp); 1505 1501 1506 1502 1507 /* Mindi always create one single parition on the USB dev */ … … 1595 1600 log_msg(2, "make_iso_fs --- scratchdir=%s --- destfile=%s", bkpinfo->scratchdir, destfile); 1596 1601 (void) getcwd(old_pwd, MAX_STR_LEN - 1); 1597 mr_asprintf(tmp, "chmod 7 55%s", bkpinfo->scratchdir);1602 mr_asprintf(tmp, "chmod 700 %s", bkpinfo->scratchdir); 1598 1603 run_program_and_log_output(tmp, FALSE); 1599 1604 mr_free(tmp); … … 2599 2604 2600 2605 if (!ok_go_ahead_burn_it) { 2601 eject_device(cdrom_dev); 2606 if (!bkpinfo->please_dont_eject) { 2607 eject_device(cdrom_dev); 2608 } 2602 2609 mds = media_descriptor_string(g_backup_media_type); 2603 2610 mr_asprintf(tmp, "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.", mds, g_current_media_number, mds); … … 3254 3261 run_program_and_log_output("umount " MNT_CDROM, FALSE); 3255 3262 // if (bkpinfo->backup_media_type != iso && !bkpinfo->please_dont_eject_when_restoring) 3256 //{3257 eject_device(bkpinfo->media_device);3258 //}3263 if (!bkpinfo->please_dont_eject) { 3264 eject_device(bkpinfo->media_device); 3265 } 3259 3266 } 3260 3267 mr_asprintf(tmp, "%s/changed.files", MONDO_CACHE); -
branches/3.1/mondo/src/common/libmondo-cli.c
r2850 r2937 488 488 *p = '\0'; 489 489 } 490 mr_asprintf(tmp1, "mount | grep -E \"^[ %s@]*%s[/]* .*\" | cut -d' ' -f3", bkpinfo->netfs_user, bkpinfo->netfs_mount);490 mr_asprintf(tmp1, "mount | grep -E \"^[a-z]*#*[%s@]*%s[/]* .*\" | cut -d' ' -f3", bkpinfo->netfs_user, bkpinfo->netfs_mount); 491 491 mr_free(bkpinfo->isodir); 492 492 bkpinfo->isodir = call_program_and_get_last_line_of_output(tmp1,TRUE); … … 776 776 777 777 if (flag_set['S']) { 778 /* Before changing remove old ones if any */ 779 if (bkpinfo->scratchdir) { 780 chdir("/tmp"); 781 mr_asprintf(tmp1, "rm -Rf %s", bkpinfo->scratchdir); 782 paranoid_system(tmp1); 783 mr_free(tmp1); 784 } 778 785 mr_asprintf(bkpinfo->scratchdir, "%s/mondo.scratch.%ld", flag_val['S'], random() % 32768); 779 786 } -
branches/3.1/mondo/src/common/libmondo-devices.c
r2850 r2937 94 94 { 95 95 // log_it("rctada: Retracting all CD trays", __LINE__); 96 if (strlen(g_cdrom_drive_is_here) > 0) { 97 inject_device(g_cdrom_drive_is_here); 98 } 99 if (strlen(g_dvd_drive_is_here) > 0) { 100 inject_device(g_dvd_drive_is_here); 101 } 102 if (strlen(g_cdrw_drive_is_here) > 0) { 103 inject_device(g_cdrw_drive_is_here); 96 if (!bkpinfo->please_dont_eject) { 97 if (strlen(g_cdrom_drive_is_here) > 0) { 98 inject_device(g_cdrom_drive_is_here); 99 } 100 if (strlen(g_dvd_drive_is_here) > 0) { 101 inject_device(g_dvd_drive_is_here); 102 } 103 if (strlen(g_cdrw_drive_is_here) > 0) { 104 inject_device(g_cdrw_drive_is_here); 105 } 104 106 } 105 107 // log_it("rctada: killing autorun"); … … 537 539 tmp1 = find_home_of_exe(cdr_exe); 538 540 if (tmp1) { 539 mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep CD| cut -d' ' -f2 | head -n1", cdr_exe);541 mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -E '[D|C][V|D]' | cut -d' ' -f2 | head -n1", cdr_exe); 540 542 tmp = call_program_and_get_last_line_of_output(command,TRUE); 541 543 mr_free(command); … … 846 848 } 847 849 848 tmp = call_program_and_get_last_line_of_output("dvdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD| cut -d':' -f1",TRUE);850 tmp = call_program_and_get_last_line_of_output("dvdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep -E '[D|C][V|D]' | cut -d':' -f1",TRUE); 849 851 log_msg(5, "tmp = '%s'", tmp); 850 852 if (!tmp[0]) 851 853 mr_free(tmp); 852 tmp = call_program_and_get_last_line_of_output("cdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD| cut -d':' -f1",TRUE);854 tmp = call_program_and_get_last_line_of_output("cdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep -E '[D|C][V|D]' | cut -d':' -f1",TRUE); 853 855 if (tmp[0]) { 854 856 devno = atoi(tmp) - 1; … … 1448 1450 if ((res = what_number_cd_is_this()) != cd_number_i_want) { 1449 1451 log_msg(3, "Currently, we hold %d but we want %d", res, cd_number_i_want); 1452 1453 /* Now we need to umount the current media to have the next mounted after */ 1454 run_program_and_log_output("umount -d " MNT_CDROM, FALSE); 1455 log_msg(3, "Mounting next media %d",cd_number_i_want); 1456 g_current_media_number = cd_number_i_want; 1457 mount_media(); 1458 1450 1459 mds = media_descriptor_string(bkpinfo->backup_media_type); 1451 1460 log_msg(3, "Insisting on %s #%d", mds, cd_number_i_want); … … 1457 1466 if (is_this_device_mounted(MNT_CDROM)) { 1458 1467 res = 1459 run_program_and_log_output("umount " MNT_CDROM, FALSE);1468 run_program_and_log_output("umount -d " MNT_CDROM, FALSE); 1460 1469 } else { 1461 1470 res = 0; … … 1995 2004 char *tmp = NULL; 1996 2005 char *tmp1 = NULL; 2006 char *tmp2 = NULL; 1997 2007 1998 2008 if (pathlist == NULL) { … … 2052 2062 /* Adds a | to ensure correct detection even at both ends */ 2053 2063 mr_asprintf(tmp1,"|%s",token); 2064 mr_asprintf(&tmp2,"|%s|",token); 2054 2065 if (mode == 'E') { 2055 2066 /* Add the token if not already in the list */ 2056 2067 mr_asprintf(tmp,"|%s|",bkpinfo->exclude_paths); 2057 if (strstr(tmp,tmp 1) == NULL) {2068 if (strstr(tmp,tmp2) == NULL) { 2058 2069 if (bkpinfo->exclude_paths) { 2059 2070 mr_strcat(bkpinfo->exclude_paths,tmp1); … … 2066 2077 /* Add the token if not already in the list */ 2067 2078 mr_asprintf(tmp,"|%s|",bkpinfo->include_paths); 2068 if (strstr(tmp,tmp 1) == NULL) {2079 if (strstr(tmp,tmp2) == NULL) { 2069 2080 mr_strcat(bkpinfo->include_paths, "%s", tmp1); 2070 2081 } … … 2072 2083 } 2073 2084 mr_free(tmp); 2085 mr_free(tmp2); 2074 2086 break; 2075 2087 } -
branches/3.1/mondo/src/common/libmondo-filelist.c
r2874 r2937 1366 1366 #if linux 1367 1367 // 2.6 has /sys as a proc-type thing -- must be excluded 1368 mr_asprintf(strtmp, "find '%s' -maxdepth %d -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype proc-prune -o -fstype sysfs -prune -o -fstype rpc_pipefs -prune -o -fstype none -prune -o %s -type d -print > %s 2> /dev/null", dir, MAX_SKEL_DEPTH, find_excludes, g_skeleton_filelist);1368 mr_asprintf(strtmp, "find '%s' -maxdepth %d -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o fstype devtmpfs -prune -o -fstype proc -prune -o -fstype selinuxfs -prune -o -fstype securityfs -prune -o -fstype hugetlbfs -o -fstype cgroup -prune -prune -o -fstype mqueue -prune -o -fstype debugfs -prune -o -fstype sysfs -prune -o -fstype rpc_pipefs -prune -o -fstype none -prune -o %s -type d -print > %s 2> /dev/null", dir, MAX_SKEL_DEPTH, find_excludes, g_skeleton_filelist); 1369 1369 #else 1370 1370 // On BSD, for example, /sys is the kernel sources -- don't exclude … … 1582 1582 mr_free(tmp1); 1583 1583 1584 mr_asprintf(exclude_paths, MONDO_CACHE"|%s|%s|%s|.|..|"MNT_CDROM"|"MNT_FLOPPY"|/media|/tmp|/proc|/sys|/ dev/shm|"MINDI_CACHE, tmp2, (bkpinfo->tmpdir[0] == '/' && bkpinfo->tmpdir[1] == '/') ? (bkpinfo->tmpdir + 1) : bkpinfo->tmpdir, (bkpinfo->scratchdir[0] == '/' && bkpinfo->scratchdir[1] == '/') ? (bkpinfo->scratchdir + 1) : bkpinfo->scratchdir);1584 mr_asprintf(exclude_paths, MONDO_CACHE"|%s|%s|%s|.|..|"MNT_CDROM"|"MNT_FLOPPY"|/media|/tmp|/proc|/sys|/run|/dev/shm|"MINDI_CACHE, tmp2, (bkpinfo->tmpdir[0] == '/' && bkpinfo->tmpdir[1] == '/') ? (bkpinfo->tmpdir + 1) : bkpinfo->tmpdir, (bkpinfo->scratchdir[0] == '/' && bkpinfo->scratchdir[1] == '/') ? (bkpinfo->scratchdir + 1) : bkpinfo->scratchdir); 1585 1585 if (excp != NULL) { 1586 1586 mr_strcat(exclude_paths,"|%s",excp); -
branches/3.1/mondo/src/common/libmondo-files-EXT.h
r2569 r2937 45 45 extern long size_of_partition_in_mountlist_K(char *tmpdir, char *dev); 46 46 47 extern int make_grub_install_scriptlet(char *outfile);48 47 extern int read_one_liner_data_file(char *fname, char *contents); -
branches/3.1/mondo/src/common/libmondo-files.c
r2850 r2937 904 904 if (res) { 905 905 log_to_screen("Please install '%s'. I cannot find it on your system.", fname); 906 log_to_screen("There may be hyperlink at http://www.mondorescue. comwhich");906 log_to_screen("There may be hyperlink at http://www.mondorescue.org which"); 907 907 log_to_screen("will take you to the relevant (missing) package."); 908 908 return (1); … … 1063 1063 /*@ buffers ******** */ 1064 1064 char *netfs_dev = NULL; 1065 char * mac_addr = NULL;1065 char *netfs_client_hwaddr = NULL; 1066 1066 char *netfs_mount = NULL; 1067 1067 char *netfs_client_ipaddr = NULL; … … 1127 1127 if (!strncmp(netfs_dev, "bond", 4) || !strncmp(netfs_dev, "alb", 3) || !strncmp(netfs_dev, "aft", 3)) { 1128 1128 log_to_screen("Found bonding device %s; looking for corresponding ethN slave device\n", netfs_dev); 1129 mr_asprintf(command, "%s", "ifconfig %s | awk '{print $5}' | head -n1", netfs_dev); 1130 mac_addr = call_program_and_get_last_line_of_output(command,TRUE); 1129 1130 mr_asprintf(command, "ifconfig %s | awk '{print $5}' | head -n1", netfs_dev); 1131 netfs_client_hwaddr = call_program_and_get_last_line_of_output(command,TRUE); 1131 1132 mr_free(command); 1132 1133 1133 mr_asprintf(command, "ifconfig | grep -E '%s' | grep -v '%s' | head -n1 | cut -d' ' -f1", mac_addr,netfs_dev); 1134 mr_free(mac_addr); 1134 mr_asprintf(command, "ifconfig | grep -E '%s' | grep -v '%s' | head -n1 | cut -d' ' -f1", netfs_client_hwaddr, netfs_dev); 1135 1135 mr_free(netfs_dev); 1136 1136 … … 1151 1151 mr_free(netfs_mount); 1152 1152 1153 mr_asprintf(tmp, "%s/NETFS-SERVER-PATH", bkpinfo->tmpdir);1154 write_one_liner_data_file(tmp, bkpinfo->netfs_remote_dir);1155 mr_free(tmp);1156 1157 1153 mr_asprintf(tmp, "%s/NETFS-CLIENT-IPADDR", bkpinfo->tmpdir); 1158 1154 write_one_liner_data_file(tmp, netfs_client_ipaddr); 1155 mr_free(tmp); 1156 1157 mr_asprintf(tmp, "%s/NETFS-CLIENT-HWADDR", bkpinfo->tmpdir); 1158 write_one_liner_data_file(tmp, netfs_client_hwaddr); 1159 1159 mr_free(tmp); 1160 1160 … … 1306 1306 } 1307 1307 1308 1309 /**1310 * Create a small script that mounts /boot, calls @c grub-install, and syncs the disks.1311 * @param outfile Where to put the script.1312 * @return 0 for success, 1 for failure.1313 */1314 int make_grub_install_scriptlet(char *outfile)1315 {1316 FILE *fout;1317 char *tmp = NULL;1318 int retval = 0;1319 1320 if ((fout = fopen(outfile, "w"))) {1321 fprintf(fout,1322 "#!/bin/sh\n\nmount /boot > /dev/null 2> /dev/null\ngrub-install $@\nres=$?\nsync;sync;sync\nexit $res\n");1323 paranoid_fclose(fout);1324 log_msg(2, "Created %s", outfile);1325 mr_asprintf(tmp, "chmod +x %s", outfile);1326 paranoid_system(tmp);1327 mr_free(tmp);1328 retval = 0;1329 } else {1330 retval = 1;1331 }1332 return (retval);1333 }1334 1335 1308 /* @} - end fileGroup */ -
branches/3.1/mondo/src/common/libmondo-files.h
r2569 r2937 44 44 int make_hole_for_dir(const char *outdir_fname); 45 45 long size_of_partition_in_mountlist_K(char *tmpdir, char *dev); 46 int make_grub_install_scriptlet(char *outfile);47 48 46 int read_one_liner_data_file(char *fname, char *contents); -
branches/3.1/mondo/src/common/libmondo-fork.c
r2704 r2937 97 97 * - @c bkpinfo->manual_cd_tray 98 98 * - @c bkpinfo->backup_media_type 99 * - @c bkpinfo->please_dont_eject_when_restoring100 99 * @param basic_call The call to mkisofs. May contain tokens that will be resolved to actual data. The tokens are: 101 100 * - @c _ISO_ will become the ISO file (@p isofile) -
branches/3.1/mondo/src/common/libmondo-mountlist.c
r2816 r2937 840 840 !strcmp(mountlist->el[items].device, "/sys") || 841 841 !strcmp(mountlist->el[items].device, "sys") || 842 !strcmp(mountlist->el[items].device, "/run") || 843 !strcmp(mountlist->el[items].device, "run") || 842 844 !strcmp(mountlist->el[items].device, "/devpts") || 843 845 !strcmp(mountlist->el[items].device, "devpts") -
branches/3.1/mondo/src/common/libmondo-raid.c
r2523 r2937 1022 1022 // get RAID level 1023 1023 token = mr_strtok(string, delims, &lastpos); 1024 // skip potential auto-read-only entry 1025 if (!strcmp(token, "(auto-read-only)")) { 1026 mr_free(token); 1027 token = mr_strtok (string, delims, &lastpos); 1028 } 1024 1029 if (!strcmp(token, "multipath")) { 1025 1030 raidlist->el[raidlist->entries].raid_level = -2; -
branches/3.1/mondo/src/common/libmondo-stream.c
r2704 r2937 737 737 738 738 set_tape_block_size_with_mt(bkpinfo->internal_tape_block_size); 739 740 /* restore compression mode on */ 741 mr_asprintf(&command, "mt -f %s compression on",bkpinfo->media_device); 742 res = run_program_and_log_output(command, 1); 743 paranoid_free(command); 744 739 745 return(res); 740 746 } -
branches/3.1/mondo/src/common/libmondo-tools.c
r2850 r2937 378 378 log_msg(1, "Post-param"); 379 379 if (bkpinfo->backup_media_type == tape) { 380 if (whine_if_not_found("mt") == 1) { 381 fatal_error("Please install the mt command"); 382 } 380 383 log_msg(1, "Tape"); 381 384 if (bkpinfo->media_device == NULL) { … … 718 721 /* purging a potential old tmpdir */ 719 722 log_it("Purging old tmpdir %s", bkpinfo->tmpdir); 723 chdir("/tmp"); 720 724 mr_asprintf(tmp,"rm -Rf %s",bkpinfo->tmpdir); 721 725 mr_free(bkpinfo->tmpdir); -
branches/3.1/mondo/src/common/libmondo-verify.c
r2508 r2937 987 987 verify_all_slices_on_CD(mountpoint); 988 988 989 mr_asprintf(tmp1, "umount %s", mountpoint);989 mr_asprintf(tmp1, "umount -d %s", mountpoint); 990 990 #ifdef __FreeBSD__ 991 991 ret += system(tmp1); … … 1118 1118 #ifdef __FreeBSD__ 1119 1119 ret = 0; 1120 mr_asprintf(command, "umount %s", mountpoint);1120 mr_asprintf(command, "umount -d %s", mountpoint); 1121 1121 ret += system(command); 1122 1122 ret += kick_vn(mddevice); 1123 1123 if (ret) { 1124 1124 #else 1125 mr_asprintf(command, "umount %s", mountpoint);1125 mr_asprintf(command, "umount -d %s", mountpoint); 1126 1126 if (system(command)) { 1127 1127 #endif … … 1136 1136 1137 1137 if (!does_file_exist(fname)) { 1138 mr_asprintf(command, "umount %s", bkpinfo->media_device);1138 mr_asprintf(command, "umount -d %s", bkpinfo->media_device); 1139 1139 run_program_and_log_output(command, 2); 1140 1140 mr_free(command); -
branches/3.1/mondo/src/common/newt-specific.c
r2874 r2937 262 262 char *tmp1 = NULL; 263 263 264 mr_asprintf(tmp,"ps %s | grep \" %s \" | awk '{print %s;}' | grep -v \"grep\"", ps_options, str , ps_proc_id);264 mr_asprintf(tmp,"ps %s | grep \" %s \" | grep -v \"grep\" | awk '{print %s;}'", ps_options, str , ps_proc_id); 265 265 run_program_and_log_output(tmp, TRUE); 266 266 if (strlen(tmp) > 0) { … … 320 320 chdir("/"); 321 321 if (g_selfmounted_isodir) { 322 mr_asprintf(command, "umount %s", g_selfmounted_isodir);322 mr_asprintf(command, "umount -d %s", g_selfmounted_isodir); 323 323 run_program_and_log_output(command, 5); 324 324 mr_free(command); … … 368 368 char *command = NULL; 369 369 370 chdir("/"); 371 run_program_and_log_output("umount " MNT_CDROM, FALSE); 370 /* Before removing dir, make sure we're out of them */ 371 chdir("/tmp"); 372 run_program_and_log_output("umount -d " MNT_CDROM, FALSE); 372 373 if (g_selfmounted_isodir) { 373 mr_asprintf(command, "umount %s", g_selfmounted_isodir);374 mr_asprintf(command, "umount -d %s", g_selfmounted_isodir); 374 375 run_program_and_log_output(command, 1); 375 376 mr_free(command); … … 382 383 log_msg(8,"tempdir is %s",bkpinfo->tmpdir); 383 384 if (strstr(bkpinfo->tmpdir ,"mondo.tmp.") != NULL) { 384 log_msg(8,"erasing tempdir ");385 log_msg(8,"erasing tempdir %s",bkpinfo->tmpdir); 385 386 mr_asprintf(command, "rm -Rf %s", bkpinfo->tmpdir); 386 387 system(command); … … 391 392 log_msg(8,"scratchdir is %s", bkpinfo->scratchdir); 392 393 if (strstr(bkpinfo->scratchdir ,"mondo.scratch.") != NULL) { 393 log_msg(8,"erasing scratchdir ");394 log_msg(8,"erasing scratchdir %s",bkpinfo->scratchdir); 394 395 mr_asprintf(command, "rm -Rf %s", bkpinfo->scratchdir); 395 396 system(command); … … 579 580 newtCenteredWindow(40, 7, title); 580 581 g_isoform_main = newtForm(NULL, NULL, 0); 581 g_isoform_timeline = newtLabel(1, 5, " This is the timeline");582 g_isoform_pcline = newtLabel(1, 6, " This is the pcline");582 g_isoform_timeline = newtLabel(1, 5, " "); 583 g_isoform_pcline = newtLabel(1, 6, " "); 583 584 newtFormAddComponents(g_isoform_main, g_isoform_timeline, 584 585 g_isoform_pcline, g_isoform_header, 585 586 g_isoform_scale, NULL); 587 newtDrawForm(g_isoform_main); 586 588 newtRefresh(); 587 589 } … … 647 649 g_scale = newtScale(3, 6, 54, (long long)g_maximum_progress); 648 650 g_progressForm = newtForm(NULL, NULL, 0); 649 g_percentline = newtLabel(10, 9, " This is the percentline");650 g_timeline = newtLabel(10, 8, " This is the timeline");651 g_percentline = newtLabel(10, 9, " "); 652 g_timeline = newtLabel(10, 8, " "); 651 653 newtFormAddComponents(g_progressForm, g_percentline, g_timeline, g_scale, g_blurb1, g_blurb3, g_blurb2, NULL); 652 654 newtPushHelpLine(b1c); 655 newtDrawForm(g_progressForm); 653 656 newtRefresh(); 654 657 } … … 969 972 } 970 973 if (!g_text_mode) { 974 newtDrawForm(g_isoform_main); 971 975 newtRefresh(); 972 976 } … … 1100 1104 mr_free(percentline_str); 1101 1105 1106 newtDrawForm(g_progressForm); 1102 1107 newtRefresh(); 1103 1108 } -
branches/3.1/mondo/src/mondorestore/mondo-prep.c
r2816 r2937 10 10 #include "mondoprep.h" 11 11 #include "../common/libmondo.h" 12 #include "../common/libmondo-tools-EXT.h" 12 13 #include "mondo-rstr-tools-EXT.h" 13 14 #include <sys/ioctl.h> … … 43 44 44 45 FILE *g_fprep = NULL; 45 46 46 extern char *g_mondo_cfg_file; // where m*ndo-restore.cfg (the config file) is stored 47 47 48 48 int g_partition_table_locked_up = 0; 49 50 51 52 53 54 55 56 49 57 50 … … 323 316 res = run_program_and_log_output(command, 5); 324 317 if (res > 0 && (p = strstr(command, "lvm "))) { 318 log_msg(0, "%s --> %d failed so removing lvm just in case", command, res); 325 319 *p = *(p + 1) = *(p + 2) = ' '; 326 320 res = run_program_and_log_output(command, 5); … … 545 539 char *level = NULL; 546 540 char *program = NULL; 541 char *tmp = NULL; 542 char *oldmd = NULL; 543 char *bootdevice; 544 char *name; 545 546 malloc_string(bootdevice); 547 malloc_string(name); 547 548 548 549 // leave straight away if raidlist is initial or has no entries … … 589 590 // - faulty devices ignored 590 591 // - persistent superblock always used as this is recommended 591 mr_asprintf(program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries); 592 // As per bug #473, the parameter "-e 0.90" is used only when: 593 // 1) It detects that system boots from Raid-1 594 // 2) grub bootloader < v1 is used. 595 // Otherwise it won't boot which is bad. 596 read_cfg_var(g_mondo_cfg_file, "bootloader.device", bootdevice); 597 read_cfg_var(g_mondo_cfg_file, "bootloader.name", name); 598 if (strcmp(name,"GRUB") == 0) { 599 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("grub --version")); 600 if ((strstr(tmp, "GRUB 0.9") != NULL) && (strcmp(raidlist->el[i].raid_device,device) == 0)) { 601 mr_free(oldmd); 602 mr_asprintf(oldmd, "-e 0.90"); 603 log_it("Forcing old metadata 0.90 for md on %s for old GRUB", device); 604 } 605 } else if ((strcmp(name,"LILO") == 0) && (strcmp(raidlist->el[i].raid_device,device) == 0)) { 606 mr_free(oldmd); 607 mr_asprintf(oldmd, "-e 0.90"); 608 log_it("Forcing old metadata 0.90 for md on %s for LILO", device); 609 } else { 610 mr_asprintf(oldmd, ""); 611 } 612 mr_free(device); 613 mr_free(name); 614 615 mr_asprintf(program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d %s", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries, oldmd); 616 mr_free(oldmd); 592 617 if (raidlist->el[i].parity != -1) { 593 618 mr_asprintf(strtmp, "%s", program); … … 2289 2314 2290 2315 /** float ***********************************************************/ 2291 long longfactor;2316 float factor; 2292 2317 long long new_size; 2293 2318 … … 2322 2347 2323 2348 drivemntlist = malloc(sizeof(struct mountlist_reference)); 2324 drivemntlist->el = 2325 malloc(sizeof(struct mountlist_line *) * MAX_MOUNTLIST_ENTRIES); 2349 drivemntlist->el = malloc(sizeof(struct mountlist_line *) * MAX_MOUNTLIST_ENTRIES); 2326 2350 2327 2351 if (!drivemntlist) { … … 2337 2361 } 2338 2362 2339 if (original_size_of_drive <= 0 ) {2363 if (original_size_of_drive <= 0LL) { 2340 2364 log_to_screen("Cannot resize %s's entries. Drive not found.", drive_name); 2341 2365 return; 2342 2366 } 2343 factor = (current_size_of_drive) / (original_size_of_drive); 2344 log_to_screen("Disk %s was %lld MB; is now %lld MB; Proportionally resizing partitions (factor ~= %lld)", drive_name, original_size_of_drive/1024, current_size_of_drive/1024, factor); 2367 factor = ((float)current_size_of_drive/(float)original_size_of_drive); 2368 mr_asprintf(tmp, "Disk %s was %lld MB; is now %lld MB; Proportionally resizing partitions (factor ~= %.5f)", 2369 drive_name, original_size_of_drive/1024, current_size_of_drive/1024, factor); 2370 log_to_screen(tmp); 2371 mr_free(tmp); 2345 2372 2346 2373 lastpart = drivemntlist->entries - 1; … … 2348 2375 /* the 'atoi' thing is to make sure we don't try to resize _images_, whose formats will be numeric */ 2349 2376 if (!atoi(drivemntlist->el[partno]->format)) { 2350 new_size = ( drivemntlist->el[partno]->size) * factor;2377 new_size = (long long)((drivemntlist->el[partno]->size) * factor); 2351 2378 } else { 2352 2379 new_size = drivemntlist->el[partno]->size; -
branches/3.1/mondo/src/mondorestore/mondo-rstr-newt.c
r2816 r2937 1804 1804 #undef ACOMP 1805 1805 1806 newtDrawForm(editraidForm); 1806 1807 newtRefresh(); 1807 1808 b_res = newtRunForm(editraidForm); -
branches/3.1/mondo/src/mondorestore/mondo-rstr-tools.c
r2850 r2937 205 205 return (1); 206 206 } 207 paranoid_system("umount "MNT_CDROM" 2> /dev/null"); /* just in case */207 paranoid_system("umount -d " MNT_CDROM " 2> /dev/null"); /* just in case */ 208 208 209 209 if (is_this_device_mounted(g_isodir_device)) { … … 612 612 } 613 613 } 614 run_program_and_log_output("umount "MNT_CDROM, FALSE);614 run_program_and_log_output("umount -d "MNT_CDROM, FALSE); 615 615 if (!does_file_exist(cfg_file)) { 616 616 log_it("%s",cfg_file); … … 684 684 if (does_file_exist(MNT_CDROM"/archives/filelist.0")) { 685 685 bkpinfo->backup_media_type = cdr; 686 run_program_and_log_output("umount "MNT_CDROM, 1);686 run_program_and_log_output("umount -d "MNT_CDROM, 1); 687 687 log_it 688 688 ("Re-jigging configuration AGAIN. CD-R, not ISO."); … … 1414 1414 if (res) { 1415 1415 popup_and_OK 1416 ("GRUB installation failed. Please install manually using 'grub-install' or similar command. You are now chroot()'ed to your restored system. Please type 'exit' when you are done."); 1417 newtSuspend(); 1418 system("chroot " MNT_RESTORING); 1419 newtResume(); 1420 popup_and_OK("Thank you."); 1416 ("GRUB installation failed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install"); 1417 if (!g_text_mode) { 1418 newtSuspend(); 1419 } 1420 sprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor); 1421 paranoid_system(tmp); 1422 sprintf(tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor); 1423 paranoid_system(tmp); 1424 if (does_file_exist(MNT_RESTORING"/boot/grub/menu.lst")) { 1425 sprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor); 1426 } else if (does_file_exist(MNT_RESTORING"/boot/grub/grub.cfg")) { 1427 sprintf(tmp, "chroot %s %s /boot/grub/grub.cfg", MNT_RESTORING, editor); 1428 } 1429 paranoid_system(tmp); 1430 sprintf(tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor); 1431 paranoid_system(tmp); 1432 if (!g_text_mode) { 1433 newtResume(); 1434 } 1435 sprintf(command, "stabgrub-me %s", boot_device); 1436 res = run_program_and_log_output(command, 1); 1437 if (res) { 1438 popup_and_OK 1439 ("GRUB installation failed. Please fix the conf files so that a manual install using 'grub-install' or similar command works. You are now chroot()'ed to your restored system. Please type 'exit' when you are done."); 1440 newtSuspend(); 1441 system("chroot " MNT_RESTORING); 1442 newtResume(); 1443 popup_and_OK("Thank you."); 1444 } else { 1445 popup_and_OK("GRUB is now installed correctly"); 1446 done = TRUE; 1447 } 1421 1448 } else { 1422 1449 done = TRUE; … … 1933 1960 1934 1961 /* Unmounting the local /proc and /sys first */ 1935 run_program_and_log_output("umount " MNT_RESTORING "/proc",3);1936 run_program_and_log_output("umount " MNT_RESTORING "/sys",3);1962 run_program_and_log_output("umount -d " MNT_RESTORING "/proc",3); 1963 run_program_and_log_output("umount -d " MNT_RESTORING "/sys",3); 1937 1964 1938 1965 for (lino = mountlist->entries - 1; lino >= 0; lino--) { … … 1948 1975 } else { 1949 1976 if (!strcmp(mountlist->el[lino].mountpoint, "/1")) { 1950 mr_asprintf(command, "umount %s/", MNT_RESTORING);1977 mr_asprintf(command, "umount -d %s/", MNT_RESTORING); 1951 1978 log_msg(3, 1952 1979 "Well, I know a certain kitty-kitty who'll be sleeping with Mommy tonight..."); 1953 1980 } else { 1954 mr_asprintf(command, "umount " MNT_RESTORING "%s", mountlist->el[lino].mountpoint);1981 mr_asprintf(command, "umount -d " MNT_RESTORING "%s", mountlist->el[lino].mountpoint); 1955 1982 1956 1983 /* To support latest Ubuntu where /var is a separate FS … … 1998 2025 *END_UNMOUNT_ALL_DEVICES * 1999 2026 **************************************************************************/ 2000 2001 2002 2027 2003 2028 /************************************************************************** -
branches/3.1/mondo/src/mondorestore/mondorestore.c
r2874 r2937 116 116 117 117 /************************************************************************** 118 * COMPAQ P ROLIANTStuff: needs some special help *118 * COMPAQ ProLiant Stuff: needs some special help * 119 119 **************************************************************************/ 120 120 121 121 /** 122 * The message to display if we detect that the user is using a Compaq Pro liant.122 * The message to display if we detect that the user is using a Compaq ProLiant. 123 123 */ 124 124 #define COMPAQ_PROLIANTS_SUCK "Partition and format your disk using Compaq's disaster recovery CD. After you've done that, please reboot with your Mondo media in Interactive Mode." … … 209 209 * @ingroup restoreUtilityGroup 210 210 */ 211 void offer_to_abort_because_Compaq_Pro liants_suck(void)211 void offer_to_abort_because_Compaq_ProLiants_suck(void) 212 212 { 213 213 popup_and_OK(COMPAQ_PROLIANTS_SUCK); … … 256 256 popup_and_OK("No restoring or comparing will take place today."); 257 257 if (is_this_device_mounted("/mnt/cdrom")) { 258 run_program_and_log_output("umount /mnt/cdrom", FALSE);258 run_program_and_log_output("umount -d /mnt/cdrom", FALSE); 259 259 } 260 260 if (g_ISO_restore_mode) { 261 mr_asprintf(tmp, "umount %s", bkpinfo->isodir);261 mr_asprintf(tmp, "umount -d %s", bkpinfo->isodir); 262 262 run_program_and_log_output(tmp, FALSE); 263 263 mr_free(tmp); … … 485 485 if (partition_table_contains_Compaq_diagnostic_partition 486 486 (mountlist)) { 487 offer_to_abort_because_Compaq_Pro liants_suck();487 offer_to_abort_because_Compaq_ProLiants_suck(); 488 488 done = TRUE; 489 489 } else { … … 693 693 } 694 694 if (is_this_device_mounted(MNT_CDROM)) { 695 paranoid_system("umount " MNT_CDROM);695 paranoid_system("umount -d " MNT_CDROM); 696 696 } 697 697 // if (! already_mounted) 698 698 // { 699 if (system("umount /tmp/isodir 2> /dev/null")) {699 if (system("umount -d /tmp/isodir 2> /dev/null")) { 700 700 log_to_screen 701 701 ("WARNING - unable to unmount device where the ISO files are stored."); … … 773 773 if (partition_table_contains_Compaq_diagnostic_partition 774 774 (mountlist)) { 775 offer_to_abort_because_Compaq_Pro liants_suck();775 offer_to_abort_because_Compaq_ProLiants_suck(); 776 776 } else { 777 777 twenty_seconds_til_yikes(); … … 949 949 "Tape : I don't need to unmount or eject the CD-ROM."); 950 950 } else { 951 run_program_and_log_output("umount " MNT_CDROM, FALSE);951 run_program_and_log_output("umount -d " MNT_CDROM, FALSE); 952 952 if (!bkpinfo->please_dont_eject) { 953 953 eject_device(bkpinfo->media_device); 954 954 } 955 955 } 956 run_program_and_log_output("umount " MNT_CDROM, FALSE);956 run_program_and_log_output("umount -d " MNT_CDROM, FALSE); 957 957 if (!bkpinfo->please_dont_eject) { 958 958 eject_device(bkpinfo->media_device); … … 2138 2138 2139 2139 /* Now we need to umount the current media to have the next mounted by insist_on_this_cd_number */ 2140 run_program_and_log_output("umount " MNT_CDROM, FALSE);2140 /* run_program_and_log_output("umount " MNT_CDROM, FALSE); */ 2141 2141 } 2142 2142 mr_free(mds); … … 2635 2635 make_hole_for_dir("/var/log"); 2636 2636 make_hole_for_dir("/tmp/tmpfs"); /* just in case... */ 2637 run_program_and_log_output("umount " MNT_CDROM, FALSE);2637 run_program_and_log_output("umount -d " MNT_CDROM, FALSE); 2638 2638 2639 2639 run_program_and_log_output("rm -Rf /tmp/tmpfs/mondo.tmp.*", FALSE); … … 2669 2669 fout = fopen("/tmp/out.txt", "w"); 2670 2670 fput_string_one_char_at_a_time(stderr, argv[2]); 2671 finish(0);2672 }2673 2674 if (argc == 3 && strcmp(argv[1], "--gendf") == 0) {2675 make_grub_install_scriptlet(argv[2]);2676 2671 finish(0); 2677 2672 } … … 2892 2887 sync(); 2893 2888 if (is_this_device_mounted(MNT_CDROM)) { 2894 run_program_and_log_output("umount " MNT_CDROM, FALSE);2889 run_program_and_log_output("umount -d " MNT_CDROM, FALSE); 2895 2890 } 2896 2891 … … 2950 2945 log_to_screen("Mondo-restore is exiting (retval=%d) ", retval); 2951 2946 2952 mr_asprintf(tmp, "umount %s", bkpinfo->isodir);2947 mr_asprintf(tmp, "umount -d %s", bkpinfo->isodir); 2953 2948 run_program_and_log_output(tmp, 5); 2954 2949 mr_free(tmp); -
branches/3.1/mondo/src/post-nuke.sample/usr/bin/Makefile.am
r424 r2937 1 1 postnukeusrbindir = $(pkgdatadir)/post-nuke.sample/usr/bin 2 postnukeusrbin_SCRIPTS = post-nuke 2 postnukeusrbin_SCRIPTS = post-nuke post-nuke.debian -
branches/3.1/mondo/src/restore-scripts/mondo/grub-MR
r2696 r2937 29 29 fi 30 30 if [ -e "$MNT_RESTORING/boot/grub/stage1" ] ; then 31 echo "Al right then."31 echo "All right then." 32 32 return 33 33 fi … … 136 136 FindBootPart $1 $2 2>&1 | tee -a $LOGFILE 137 137 mbrdev=`echo $1 | sed 's/\([^0-9]*\)[0-9]*$/\1/'` 138 if echo $ bootpart| grep "/cciss/" > /dev/null ; then139 partno=`basename $ bootpart| cut -d'p' -f2`138 if echo $mbrdev | grep "/cciss/" > /dev/null ; then 139 partno=`basename $mbrdev | cut -d'p' -f2` 140 140 mbrdev=`echo $mbrdev | cut -d'p' -f1` 141 elif echo $ bootpart| grep "/mapper/mpath" > /dev/null ; then142 partno=`basename $ bootpart| cut -d'p' -f3`143 mbrdev=`echo $mbrdev | cut -d'p' -f1 `144 else 145 partno=`basename $ bootpart| sed 's/[a-z]*//'`141 elif echo $mbrdev | grep "/mapper/mpath" > /dev/null ; then 142 partno=`basename $mbrdev | cut -d'p' -f3` 143 mbrdev=`echo $mbrdev | cut -d'p' -f1-4` 144 else 145 partno=`basename $mbrdev | sed 's/[a-z]*//'` 146 146 fi 147 147 if [ ! "$partno" ] ; then … … 150 150 partno=$(($partno-1)) 151 151 fi 152 if echo $ bootpart| grep "/md" > /dev/null ; then152 if echo $mbrdev | grep "/md" > /dev/null ; then 153 153 # FIXME: Why this if not used later 154 154 base=`basename $bootpart`
Note:
See TracChangeset
for help on using the changeset viewer.