Changeset 2395 in MondoRescue
- Timestamp:
- Sep 12, 2009, 2:57:02 AM (16 years ago)
- Location:
- branches/2.2.10
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mindi/mindi
r2391 r2395 653 653 lvScanRes=`gzip -cd $lvKernelImage | strings | grep -E "$lcMagicCramfs|$lcMagicExt2fs|$lcMagicExt3fs|$lcMagicInitfs"` 654 654 else 655 # get offet of gzip magic "1f8b0800" in file 655 # Since 2.6.30 kernel can use lzma and bzip2 in addition to gzip for initramfs compression 656 # get offet of gzip magic "1f8b0800" in file (or 1f8b9e ??) 656 657 lvOffset=`od -vA n -t x1 $lvKernelImage | tr -d '[:space:]' | awk '{ print match($0, "1f8b0800")}'` 657 [ $lvOffset -eq 0 ] && Die "gzip magic not found in file $lvKernelImage. Terminating." 658 if [ $lvOffset -eq 0 ]; then 659 # get offet of bzip2 magic "425a" in file 660 lvOffset=`od -vA n -t x1 $lvKernelImage | tr -d '[:space:]' | awk '{ print match($0, "425a")}'` 661 if [ $lvOffset -eq 0 ]; then 662 # get offet of lzma magic "5d00" in file 663 lvOffset=`od -vA n -t x1 $lvKernelImage | tr -d '[:space:]' | awk '{ print match($0, "5d00")}'` 664 if [ $lvOffset -eq 0 ]; then 665 Die "No magic compression pattern found in file $lvKernelImage. Terminating." 666 else 667 comp="lzma" 668 fi 669 else 670 comp="bzip2" 671 fi 672 else 673 comp="gzip" 674 fi 675 658 676 lvOffset=`expr $lvOffset / 2` 659 LogFile " GetInitrdFilesystemToUse(): gzip magic found at lvOffset $lvOffset.\n"677 LogFile " GetInitrdFilesystemToUse(): $comp magic found in $lvKernelImage at lvOffset $lvOffset.\n" 660 678 661 679 # scan kernel image for initrd filessystem support 662 lvScanRes=`dd ibs=1 skip=$lvOffset if=$lvKernelImage obs=1M 2>/dev/null | gunzip -c 2> /dev/null | strings | grep -E "$lcMagicCramfs|$lcMagicExt2fs|$lcMagicExt3fs|$lcMagicInitfs"`680 lvScanRes=`dd ibs=1 skip=$lvOffset if=$lvKernelImage obs=1M 2>/dev/null | $comp -dc 2> /dev/null | strings | grep -E "$lcMagicCramfs|$lcMagicExt2fs|$lcMagicExt3fs|$lcMagicInitfs"` 663 681 fi 664 682 -
branches/2.2.10/mondo/src/common/libmondo-mountlist-EXT.h
r2385 r2395 1 1 /* libmondo-mountlist-EXT.h */ 2 2 3 extern char *evaluate_mountlist(struct mountlist_itself *mountlist , int *res);3 extern char *evaluate_mountlist(struct mountlist_itself *mountlist); 4 4 extern int find_device_in_mountlist(struct mountlist_itself *mountlist, 5 5 char *device); -
branches/2.2.10/mondo/src/common/libmondo-mountlist.c
r2385 r2395 517 517 * for each drive, and then spreads the flaws across three lines. 518 518 * @param mountlist The mountlist to evaluate. 519 * @param flaws_str_A Where to put the first line listing errors found. 520 * @param flaws_str_B Where to put the second line listing errors found. 521 * @param flaws_str_C Where to put the third line listing errors found. 522 * @return The number of flaws found (0 for success). 519 * @return The flaws string (NULL for success). 523 520 * @see evaluate_drive_within_mountlist 524 521 */ 525 char *evaluate_mountlist(struct mountlist_itself *mountlist , int *res) {522 char *evaluate_mountlist(struct mountlist_itself *mountlist) { 526 523 527 524 /*@ buffer *********************************************************** */ … … 542 539 /*@ initialize ******************************************************* */ 543 540 544 *res = 0;545 541 drivelist = malloc(sizeof(struct list_of_disks)); 546 542 assert(mountlist != NULL); 547 548 mr_asprintf(flaws_str, "%s", "");549 543 550 544 make_list_of_drives_in_mountlist(mountlist, drivelist); … … 560 554 log_msg(8, "Evaluating drive #%d (%s) within mountlist", i, drivelist->el[i].device); 561 555 tmp = evaluate_drive_within_mountlist(mountlist, drivelist->el[i].device); 562 if (tmp != NULL) {563 (*res)++;564 }565 556 } 566 557 log_msg(8,"Entry: %d (%s)", i, drivelist->el[i].device); 567 558 /* BCO: tmp can be NULL */ 568 559 if (tmp != NULL) { 569 log_msg(8,"Adding: %s to %s", tmp, flaws_str);560 log_msg(8,"Adding: %s to flaws_str", tmp); 570 561 mr_strcat(flaws_str, "%s", tmp); 571 562 mr_free(tmp); … … 589 580 mr_asprintf(tmp, " %s %s's.", number_to_text(copies), curr_mountpoint); 590 581 mr_strcat(flaws_str, "%s", tmp); 591 log_ it(tmp);582 log_msg(8,"Adding: %s to flaws_str", tmp); 592 583 mr_free(tmp); 593 (*res)++;594 584 } 595 585 mr_free(curr_mountpoint); -
branches/2.2.10/mondo/src/common/libmondo-mountlist.h
r2385 r2395 4 4 5 5 6 char *evaluate_mountlist(struct mountlist_itself *mountlist , int *res);6 char *evaluate_mountlist(struct mountlist_itself *mountlist); 7 7 int find_device_in_mountlist(struct mountlist_itself *mountlist, 8 8 char *device); -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-newt.c
r2382 r2395 1924 1924 /** int **************************************************************/ 1925 1925 int i = 0; 1926 int res = 0;1927 1926 int currline = 0; 1928 1927 int finished = FALSE; … … 1965 1964 bEdit, bDelete, bReload, bCancel, bOK, NULL); 1966 1965 while (!finished) { 1967 flaws_str = evaluate_mountlist(mountlist , &res);1966 flaws_str = evaluate_mountlist(mountlist); 1968 1967 if (strlen(flaws_str) > 0) { 1969 1968 mr_asprintf(flaws_str_A, "%s", flaws_str + 1); … … 1996 1995 1997 1996 if (b_res == bOK) { 1998 flaws_str = evaluate_mountlist(mountlist , &res);1999 mr_free(flaws_str);2000 if (!res) {1997 flaws_str = evaluate_mountlist(mountlist); 1998 if (flaws_str != NULL) { 1999 mr_free(flaws_str); 2001 2000 finished = 2002 2001 ask_me_yes_or_no -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-newt.h
r2385 r2395 137 137 struct raidlist_itself *); 138 138 void edit_raidrec_additional_vars(struct raid_device_record *); 139 char *evaluate_mountlist(struct mountlist_itself * , int *);139 char *evaluate_mountlist(struct mountlist_itself *); 140 140 int find_device_in_mountlist(struct mountlist_itself *, char *); 141 141 int find_next_free_index_in_disklist(struct list_of_disks *); -
branches/2.2.10/mondo/src/mondorestore/mondorestore.c
r2391 r2395 774 774 mr_free(tmp); 775 775 776 flaws_str = evaluate_mountlist(mountlist , &res);777 if ( !res) {776 flaws_str = evaluate_mountlist(mountlist); 777 if (flaws_str != NULL) { 778 778 mr_asprintf(tmp, "Mountlist analyzed. Result: \"%s\" Switch to Interactive Mode?", flaws_str); 779 779 mr_free(flaws_str); … … 787 787 } 788 788 } 789 mr_free(flaws_str);790 789 791 790 save_mountlist_to_disk(mountlist, g_mountlist_fname); -
branches/2.2.10/mondo/src/mondorestore/mr-externs.h
r2382 r2395 109 109 extern bool g_restoring_live_from_netfs; 110 110 extern int fput_string_one_char_at_a_time(FILE *, char *); 111 extern char *evaluate_mountlist(struct mountlist_itself *mountlist , int *res);111 extern char *evaluate_mountlist(struct mountlist_itself *mountlist); 112 112 113 113 -
branches/2.2.10/mondo/test/test-mountlist.c
r2352 r2395 50 50 struct mountlist_itself *mountlist = NULL; 51 51 struct raidlist_itself *raidlist = NULL; 52 int ret = 0;53 52 char *flaws_str = NULL; 54 53 … … 80 79 log_it("after edit_mountlist"); 81 80 82 flaws_str = evaluate_mountlist(mountlist , &ret);81 flaws_str = evaluate_mountlist(mountlist); 83 82 log_it("after evaluate_mountlist"); 84 83 mr_free(flaws_str);
Note:
See TracChangeset
for help on using the changeset viewer.