Changeset 181 in MondoRescue for trunk/mondo
- Timestamp:
- Dec 13, 2005, 1:35:27 AM (19 years ago)
- Location:
- trunk/mondo
- Files:
-
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/configure.in
r129 r181 1 dnl Autoconfigure file for Mondo Rescue v2.0x _berlios1 dnl Autoconfigure file for Mondo Rescue v2.0x 2 2 dnl Mondo by Hugo Rabson 3 3 dnl This script by Joshua Oreman -
trunk/mondo/mondo.spec
r129 r181 119 119 120 120 %attr(755,root,root) %{_sbindir}/* 121 %attr(755,root,root) %{_ datadir}/%{name}/restore-scripts/%{name}122 %{_ datadir}/%{name}121 %attr(755,root,root) %{_libdir}/%{name}/restore-scripts/%{name} 122 %{_libdir}/%{name} 123 123 %{_mandir}/* 124 124 %{_libdir}/* … … 127 127 * Tue Oct 06 2005 Bruno Cornec <bcornec@users.berlios.de> 2.05_berlios 128 128 - Memory management revision 129 - use libdir instead of datadir 129 130 130 131 * Tue Sep 06 2005 Bruno Cornec <bcornec@users.berlios.de> 2.04_berlios -
trunk/mondo/mondo/Makefile.am
r129 r181 1 1 SUBDIRS = common mondoarchive mondorestore docs restore-scripts 2 2 3 pkg data_DATA = do-not-compress-these3 pkglib_DATA = do-not-compress-these 4 4 5 5 install-data-hook: post-nuke.sample 6 cp -R post-nuke.sample $(pkg datadir)/6 cp -R post-nuke.sample $(pkglibdir)/ -
trunk/mondo/mondo/mondorestore/mondo-restore.c
r171 r181 3375 3375 toggle_node_selection(filelist, FALSE); 3376 3376 toggle_all_root_dirs_on(filelist); 3377 // BERLIOS: /usr/lib ??? 3377 3378 toggle_path_selection(filelist, "/usr/share", TRUE); 3378 3379 // show_filelist(filelist); -
trunk/mondo/mondo/mondorestore/mondo-rstr-newt.c
r127 r181 1 1 /*************************************************************************** 2 mondo-rstr-newt.c - description 3 ----------------- 4 5 begin: Fri Apr 19 16:40:35 EDT 2002 6 copyright : (C) 2002 Mondo Hugo Rabson 7 email : Hugo Rabson <hugorabson@msn.com> 8 edited by : by Stan Benoit 4/2002 9 email : troff@nakedsoul.org 10 cvsid : $Id$ 11 ***************************************************************************/ 12 13 /*************************************************************************** 14 * * 15 * This program is free software; you can redistribute it and/or modify * 16 * it under the terms of the GNU General Public License as published by * 17 * the Free Software Foundation; either version 2 of the License, or * 18 * (at your option) any later version. * 19 * * 20 ***************************************************************************/ 21 /* mondo-rstr-newt.c Hugo Rabson 22 23 24 07/12 25 - wider mountlist entry editor window 26 27 03/28/2004 28 - removed g_mountlist_fname 29 30 07/02/2003 31 - fixed calls to popup_and_get_string() 32 33 06/05 34 - cleaned up get_isodir_info() 35 36 05/02 37 - added strip_path() to improve file list display for long paths (Conor) 38 39 04/24 40 - added lots of assert()'s and log_OS_error()'s 41 42 04/08/2003 43 - commented out call to sort_mountlist_by_device(), just in case it's 44 futzing with LVM/RAID users 45 46 08/21/2002 47 - fix MOUNTLIST_FNAME and RAIDTAB_FNAME if Reload button finds them empty 48 49 08/19 50 - fixed what_number_cd_is_this() to take bkpinfo as parameter 51 52 07/01 - 07/31 53 - renamed from mondo-newt.c to mondo-rstr-newt.c 54 - moved lots of subroutines to libmondo-newt.c 55 - added hooks to libmondo 56 - better handling of yes/no/YES/NO 57 - better "% done" feedback (Philippe de Muyter) 58 59 05/01 - 06/30 60 - trim trailing \n from fgets() in a couple of functions 61 - expanded "May I write mountlist?" message 62 - replace scanf() with a properly restricted fgets() (Troff) 63 64 02/01 - 02/28/2002 65 - allow up to 50 chars in popup_and_get_string()'s input field 66 - if g_current_progress > g_maximum_progress then g_current_progress=g_max... 67 to stop the progress bar from shooting off the RHS of the screen :) 68 - beefed up the RAID-related logging a bit 69 - don't complain if partition format is a number (1-255) 70 - if hard disk does not exist then warn user when editing mountlist 71 - when running 'eject -t', log its output 72 73 [...] 74 75 08/09/2001 76 - created 2 * $Id$ 77 3 */ 78 4 … … 131 57 { 132 58 /** buffers ***********************************************************/ 133 char tmp[MAX_STR_LEN];59 char *tmp; 134 60 135 61 /** newt **************************************************************/ … … 157 83 newtPushHelpLine 158 84 (" Add one of the following unallocated RAID partitions to this RAID device."); 159 sprintf(tmp, "%-26s %s", "Device", "Size");85 asprintf(&tmp, "%-26s %s", "Device", "Size"); 160 86 headerMsg = newtLabel(1, 1, tmp); 87 paranoid_free(tmp); 88 161 89 partitionsListbox = 162 90 newtListbox(1, 2, 6, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT); … … 196 124 197 125 198 199 200 126 /** 201 127 * Add an entry to @p mountlist. … … 232 158 233 159 /** buffers **********************************************************/ 234 char drive_to_add[MAX_STR_LEN];235 char mountpoint_str[MAX_STR_LEN];236 char size_str[MAX_STR_LEN];237 char device_str[MAX_STR_LEN];238 char format_str[MAX_STR_LEN];160 char *drive_to_add; 161 char *mountpoint_str; 162 char *size_str = NULL; 163 char *device_str; 164 char *format_str; 239 165 240 166 /** pointers *********************************************************/ … … 249 175 assert(keylist != NULL); 250 176 251 strcpy(device_str, "/dev/");252 strcpy(mountpoint_str, "/");177 asprintf(&device_str, "/dev/"); 178 asprintf(&mountpoint_str, "/"); 253 179 #ifdef __FreeBSD__ 254 strcpy(format_str, "ufs");180 asprintf(&format_str, "ufs"); 255 181 #else 256 strcpy(format_str, "ext2");182 asprintf(&format_str, "ext2"); 257 183 #endif 258 size_str[0] = '\0';259 /* sprintf(size_str,""); */260 184 newtOpenWindow(20, 5, 48, 10, "Add entry"); 261 185 label0 = newtLabel(2, 1, "Device: "); … … 267 191 mountpointComp = 268 192 newtEntry(14, 2, mountpoint_str, 30, (void *) &mountpoint_here, 0); 193 269 194 formatComp = 270 195 newtEntry(14, 4, format_str, 15, (void *) &format_here, 0); … … 280 205 for (b_res = NULL; b_res != bOK && b_res != bCancel;) { 281 206 b_res = newtRunForm(myForm); 282 strcpy(device_str, device_here); 283 strcpy(mountpoint_str, mountpoint_here); 284 strcpy(format_str, format_here); 285 strcpy(size_str, size_here); 286 // log_it ("Originals = %s,%s,%s,%s", device_str, mountpoint_str, format_str, size_str); 207 208 paranoid_free(device_str); 209 asprintf(&device_str, device_here); 287 210 strip_spaces(device_str); 211 212 paranoid_free(format_str); 213 asprintf(&format_str, format_here); 214 strip_spaces(format_str); 215 216 paranoid_free(mountpoint_str); 217 asprintf(&mountpoint_str, mountpoint_here); 288 218 strip_spaces(mountpoint_str); 289 strip_spaces(format_str); 219 220 paranoid_free(size_str); 221 asprintf(&size_str, size_here); 290 222 strip_spaces(size_str); 291 // log_it ("Modified = %s,%s,%s,%s", device_str, mountpoint_str, format_str, size_str); 223 292 224 if (b_res == bOK) { 293 225 if (device_str[strlen(device_str) - 1] == '/') { … … 308 240 return; 309 241 } 310 strcpy(drive_to_add, device_str);242 asprintf(&drive_to_add, device_str); 311 243 for (i = strlen(drive_to_add); isdigit(drive_to_add[i - 1]); i--); 312 244 num_to_add = atoi(drive_to_add + i); 313 245 drive_to_add[i] = '\0'; 246 paranoid_free(drive_to_add); 247 314 248 currline = mountlist->entries; 315 249 strcpy(mountlist->el[currline].device, device_str); 316 250 strcpy(mountlist->el[currline].mountpoint, mountpoint_str); 251 paranoid_free(mountpoint_str); 252 317 253 strcpy(mountlist->el[currline].format, format_str); 254 paranoid_free(format_str); 255 318 256 mountlist->el[currline].size = atol(size_str) * 1024; 257 paranoid_free(size_str); 258 319 259 mountlist->entries++; 320 260 if (strstr(mountlist->el[currline].device, RAID_DEVICE_STUB)) { … … 322 262 device_str); 323 263 } 264 paranoid_free(device_str); 324 265 redraw_mountlist(mountlist, keylist, listbox); 325 266 } … … 336 277 337 278 /** buffers ***********************************************************/ 338 char sz_out[MAX_STR_LEN];279 char *sz_out = NULL; 339 280 340 281 /** int ****************************************************************/ … … 344 285 assert(raidrec != NULL); 345 286 346 sz_out[0] = '\0';347 287 if (popup_and_get_string 348 288 ("Add variable", "Enter the name of the variable to add", sz_out, … … 396 336 397 337 /** buffers ***********************************************************/ 398 char tmp[MAX_STR_LEN]; 338 char *tmp; 339 char *devname; 399 340 400 341 … … 405 346 && strcmp(raidlist->el[i].volname, basename(raid_device)); i++); 406 347 if (i == raidlist->entries) { 407 sprintf(tmp,348 asprintf(&tmp, 408 349 "Cannot calc size of raid device %s - cannot find it in raidlist", 409 350 raid_device); 410 351 log_it(tmp); 352 paranoid_free(tmp); 411 353 return (0); // Isn't this more sensible than 999999999? If the raid dev !exists, 412 354 // then it has no size, right? … … 420 362 int k = 0, l = 0; 421 363 for (k = 0; k < raidrec->plex[j].subdisks; ++k) { 422 char devname[64]; 423 strcpy(devname, raidrec->plex[j].sd[k].which_device); 364 asprintf(&devname, raidrec->plex[j].sd[k].which_device); 424 365 for (l = 0; l < raidlist->disks.entries; ++l) { 425 366 if (!strcmp(devname, raidlist->disks.el[l].name)) { … … 449 390 } 450 391 } 392 paranoid_free(devname); 451 393 } 452 394 … … 469 411 } 470 412 471 sprintf(tmp, "I have calculated %s's real size to be %ld", raid_device,413 asprintf(&tmp, "I have calculated %s's real size to be %ld", raid_device, 472 414 (long) smallest_plex); 473 415 log_it(tmp); 416 paranoid_free(tmp); 474 417 return (smallest_plex); 475 418 #else … … 489 432 490 433 /** buffers ***********************************************************/ 491 char tmp[MAX_STR_LEN];434 char *tmp; 492 435 493 436 assert(mountlist != NULL); … … 499 442 && strcmp(raidlist->el[i].raid_device, raid_device); i++); 500 443 if (i == raidlist->entries) { 501 sprintf(tmp,444 asprintf(&tmp, 502 445 "Cannot calc size of raid device %s - cannot find it in raidlist", 503 446 raid_device); 504 447 log_it(tmp); 448 paranoid_free(tmp); 505 449 return (999999999); 506 450 } … … 525 469 total_size = smallest_partition * (noof_partitions - 1); 526 470 } 527 sprintf(tmp, "I have calculated %s's real size to be %ld", raid_device,471 asprintf(&tmp, "I have calculated %s's real size to be %ld", raid_device, 528 472 (long) total_size); 529 473 log_it(tmp); 474 paranoid_free(tmp); 530 475 return (total_size); 531 476 #endif … … 550 495 551 496 /** buffers ***********************************************************/ 552 char tmp[MAX_STR_LEN];553 char prompt[MAX_STR_LEN];554 char sz[MAX_STR_LEN];555 556 sprintf(prompt,497 char *tmp; 498 char *prompt; 499 char *sz; 500 501 asprintf(&prompt, 557 502 "Please enter the RAID level you want. (concat, striped, raid5)"); 558 503 if (raidrec->raidlevel == -1) { 559 strcpy(tmp, "concat");504 asprintf(&tmp, "concat"); 560 505 } else if (raidrec->raidlevel == 0) { 561 strcpy(tmp, "striped");506 asprintf(&tmp, "striped"); 562 507 } else { 563 sprintf(tmp, "raid%i", raidrec->raidlevel);508 asprintf(&tmp, "raid%i", raidrec->raidlevel); 564 509 } 565 510 for (out = 999; out == 999;) { … … 570 515 strip_spaces(tmp); 571 516 if (tmp[0] == '[' && tmp[strlen(tmp) - 1] == ']') { 572 strcpy(sz, tmp);517 asprintf(&sz, tmp); 573 518 strncpy(tmp, sz + 1, strlen(sz) - 2); 574 519 tmp[strlen(sz) - 2] = '\0'; 520 paranoid_free(sz); 575 521 } 576 522 if (!strcmp(tmp, "concat")) { … … 582 528 } 583 529 log_it(tmp); 530 paranoid_free(tmp); 584 531 if (is_this_raid_personality_registered(out)) { 585 532 log_it … … 593 540 } 594 541 } 542 paranoid_free(prompt); 595 543 raidrec->raidlevel = out; 596 544 #else 597 545 /** buffers ***********************************************************/ 598 char tmp[MAX_STR_LEN];546 char *tmp; 599 547 char personalities[MAX_STR_LEN]; 600 char prompt[MAX_STR_LEN];601 char sz[MAX_STR_LEN];548 char *prompt; 549 char *sz; 602 550 int out = 0, res = 0; 603 551 … … 608 556 strcpy(personalities, 609 557 last_line_of_file("/tmp/raid-personalities.txt")); 610 sprintf(prompt, "Please enter the RAID level you want. %s",558 asprintf(&prompt, "Please enter the RAID level you want. %s", 611 559 personalities); 612 560 if (raidrec->raid_level == -1) { 613 strcpy(tmp, "linear");561 asprintf(&tmp, "linear"); 614 562 } else { 615 sprintf(tmp, "%d", raidrec->raid_level);563 asprintf(&tmp, "%d", raidrec->raid_level); 616 564 } 617 565 for (out = 999; … … 624 572 strip_spaces(tmp); 625 573 if (tmp[0] == '[' && tmp[strlen(tmp) - 1] == ']') { 626 strcpy(sz, tmp);574 asprintf(&sz, tmp); 627 575 strncpy(tmp, sz + 1, strlen(sz) - 2); 628 576 tmp[strlen(sz) - 2] = '\0'; 577 paranoid_free(sz); 629 578 } 630 579 if (!strcmp(tmp, "linear")) { … … 636 585 } 637 586 log_it(tmp); 587 paranoid_free(tmp); 638 588 if (is_this_raid_personality_registered(out)) { 639 589 log_it … … 647 597 } 648 598 } 599 paranoid_free(prompt); 649 600 raidrec->raid_level = out; 650 601 #endif 651 602 } 652 653 603 654 604 … … 672 622 673 623 /** buffers ***********************************************************/ 674 char tmp[MAX_STR_LEN];624 char *tmp; 675 625 676 626 assert(mountlist != NULL); … … 684 634 pos++); 685 635 if (pos < mountlist->entries) { 686 sprintf(tmp,636 asprintf(&tmp, 687 637 "Deleting partition %s cos it was part of a now-defunct RAID", 688 638 mountlist->el[pos].device); 689 639 log_it(tmp); 640 paranoid_free(tmp); 690 641 memcpy((void *) &mountlist->el[pos], 691 642 (void *) &mountlist->el[mountlist->entries - 1], … … 695 646 } 696 647 } 697 698 648 699 649 … … 715 665 716 666 /** buffers ***********************************************************/ 717 char tmp[MAX_STR_LEN];667 char *tmp; 718 668 719 669 assert(disklist != NULL); 720 670 assert_string_is_neither_NULL_nor_zerolength(raid_device); 721 671 722 sprintf(tmp, "Delete %s from RAID device %s - are you sure?",672 asprintf(&tmp, "Delete %s from RAID device %s - are you sure?", 723 673 disklist->el[currline].device, raid_device); 724 674 if (!ask_me_yes_or_no(tmp)) { 675 paranoid_free(tmp); 725 676 return; 726 677 } 678 paranoid_free(tmp); 727 679 for (pos = currline; pos < disklist->entries - 1; pos++) { 728 680 /* memcpy((void*)&disklist->el[pos], (void*)&disklist->el[pos+1], sizeof(struct s_disk)); */ … … 731 683 disklist->entries--; 732 684 } 733 734 685 735 686 … … 754 705 755 706 /** buffers ***********************************************************/ 756 char tmp[MAX_STR_LEN]; 757 char device[MAX_STR_LEN]; 758 707 char *tmp; 708 char *device; 759 709 760 710 assert(mountlist != NULL); … … 768 718 device); 769 719 if (pos >= 0) { 770 sprintf(tmp, "Cannot delete %s: it is in use by RAID device %s",720 asprintf(&tmp, "Cannot delete %s: it is in use by RAID device %s", 771 721 mountlist->el[currline].device, 772 722 raidlist->el[pos].OSSWAP(raid_device, volname)); 773 723 popup_and_OK(tmp); 724 paranoid_free(tmp); 774 725 return; 775 726 } 776 sprintf(tmp, "Delete %s - are you sure?",727 asprintf(&tmp, "Delete %s - are you sure?", 777 728 mountlist->el[currline].device); 778 729 if (!ask_me_yes_or_no(tmp)) { 730 paranoid_free(tmp); 779 731 return; 780 732 } 733 paranoid_free(tmp); 734 781 735 if (strstr(mountlist->el[currline].device, RAID_DEVICE_STUB)) { 782 strcpy(device, mountlist->el[currline].device);736 asprintf(&device, mountlist->el[currline].device); 783 737 delete_raidlist_entry(mountlist, raidlist, device); 784 738 for (currline = 0; … … 788 742 if (currline == mountlist->entries) { 789 743 log_it("Dev is gone. I can't delete it. Ho-hum"); 744 paranoid_free(device); 790 745 return; 791 746 } 747 paranoid_free(device); 792 748 } 793 749 memcpy((void *) &mountlist->el[currline], … … 819 775 820 776 /** buffers ***********************************************************/ 821 char tmp[MAX_STR_LEN];777 char *tmp; 822 778 823 779 assert(mountlist != NULL); … … 829 785 return; 830 786 } 831 sprintf(tmp, "Do you want me to delete %s's partitions, too?", device);787 asprintf(&tmp, "Do you want me to delete %s's partitions, too?", device); 832 788 delete_partitions_too = ask_me_yes_or_no(tmp); 833 789 if (delete_partitions_too) { … … 873 829 items--; 874 830 } 831 paranoid_free(tmp); 832 875 833 raidlist->entries = items; 876 834 } … … 888 846 889 847 /** buffers ************************************************************/ 890 char tmp[MAX_STR_LEN];848 char *tmp; 891 849 892 850 /** structures *********************************************************/ … … 896 854 897 855 av = &raidrec->additional_vars; 898 sprintf(tmp, "Delete %s - are you sure?", av->el[lino].label);856 asprintf(&tmp, "Delete %s - are you sure?", av->el[lino].label); 899 857 if (ask_me_yes_or_no(tmp)) { 900 858 if (!strcmp(av->el[lino].label, "persistent-superblock") 901 859 || !strcmp(av->el[lino].label, "chunk-size")) { 902 sprintf(tmp, "%s must not be deleted. It would be bad.", 860 paranoid_free(tmp); 861 asprintf(&tmp, "%s must not be deleted. It would be bad.", 903 862 av->el[lino].label); 904 863 popup_and_OK(tmp); … … 908 867 } 909 868 } 869 paranoid_free(tmp); 910 870 } 911 871 #endif … … 934 894 935 895 /** buffers **********************************************************/ 936 static char current_filename[MAX_STR_LEN];937 char tmp[MAX_STR_LEN + 2];896 static char *current_filename; 897 char *tmp; 938 898 939 899 /** bool *************************************************************/ … … 966 926 if (!warned_already) { 967 927 warned_already = TRUE; 968 sprintf(tmp,928 asprintf(&tmp, 969 929 "Too many lines. Displaying first %d entries only. Close a directory to see more.", 970 930 ARBITRARY_MAXIMUM); 971 931 popup_and_OK(tmp); 932 paranoid_free(tmp); 972 933 } 973 934 } else { … … 988 949 (g_strings_of_flist_window[i], 989 950 g_strings_of_flist_window[i - 1]) < 0) { 990 strcpy(tmp, g_strings_of_flist_window[i]);951 asprintf(&tmp, g_strings_of_flist_window[i]); 991 952 strcpy(g_strings_of_flist_window[i], 992 953 g_strings_of_flist_window[i - 1]); 993 954 strcpy(g_strings_of_flist_window[i - 1], tmp); 955 paranoid_free(tmp); 956 994 957 dummybool = g_is_path_selected[i]; 995 958 g_is_path_selected[i] = g_is_path_selected[i - 1]; … … 1001 964 newtListboxClear(listbox); 1002 965 for (i = 0; i < lines_in_flist_window; i++) { 1003 sprintf(tmp, "%c%c %-80s", (g_is_path_selected[i] ? '*' : ' '),966 asprintf(&tmp, "%c%c %-80s", (g_is_path_selected[i] ? '*' : ' '), 1004 967 (g_is_path_expanded[i] ? '+' : '-'), 1005 968 strip_path(g_strings_of_flist_window[i])); 1006 tmp[70] = '\0'; 969 // BERLIOS: this is dangerous now 970 if (strlen(tmp) > 71) { 971 tmp[70] = '\0'; 972 } 1007 973 keylist[i] = (void *) i; 1008 974 newtListboxAppendEntry(listbox, tmp, keylist[i]); 975 paranoid_free(tmp); 1009 976 } 1010 977 return (lines_in_flist_window); -
trunk/mondo/mondo/restore-scripts/Makefile.am
r30 r181 1 1 SUBDIRS = mondo usr 2 2 3 restoreetcdir = $(pkg datadir)/restore-scripts/etc3 restoreetcdir = $(pkglibdir)/restore-scripts/etc 4 4 restoreetc_DATA = etc/multipath.conf.sample etc/raid0.conf.sample \ 5 5 etc/raid1.conf.sample etc/raid4.conf.sample \ -
trunk/mondo/mondo/restore-scripts/mondo/Makefile.am
r30 r181 1 restoremondodir = $(pkg datadir)/restore-scripts/mondo1 restoremondodir = $(pkglibdir)/restore-scripts/mondo 2 2 restoremondo_SCRIPTS = ISO ask-me-a-question compare-me compare-subroutine-me \ 3 3 edit-mountlist grub-MR hack-fstab hack-grub hack-lilo hack-elilo \ -
trunk/mondo/mondo/restore-scripts/usr.bin/Makefile.am
r30 r181 1 restoreusrbindir = $(pkg datadir)/restore-scripts/usr/bin1 restoreusrbindir = $(pkglibdir)/restore-scripts/usr/bin 2 2 #restoreusrbin_SCRIPTS = # petris pico nano -
trunk/mondo/mondo/restore-scripts/usr/bin/Makefile.am
r30 r181 1 restoreusrbindir = $(pkg datadir)/restore-scripts/usr/bin1 restoreusrbindir = $(pkglibdir)/restore-scripts/usr/bin 2 2 #restoreusrbin_SCRIPTS = petris nano
Note:
See TracChangeset
for help on using the changeset viewer.