Changeset 3377 in MondoRescue
- Timestamp:
- May 6, 2015, 1:10:17 PM (10 years ago)
- Location:
- branches/3.2
- Files:
-
- 11 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi/README.ia64
r3371 r3377 3 3 Linux distributions on ia64 uses a different file table format than on i386, called GPT instead of MBR. The fdisk command used by mindi/mondo to determine all aspects related to the disc hasn't been adapted yet to handle GPT. Only the parted command is able to do it. 4 4 5 So a perl script called mr _parted2fdisk was written that will take as input all the order that mindi/mondo pass to fdisk, translate them to be given to parted and print the result in fdisk format. So this is a filter allowing fdisk replacement. It's only used on ia64. On other archs, mr_parted2fdisk is a link to fdisk.5 So a perl script called mr-parted2fdisk was written that will take as input all the order that mindi/mondo pass to fdisk, translate them to be given to parted and print the result in fdisk format. So this is a filter allowing fdisk replacement. It's only used on ia64. On other archs, mr-parted2fdisk is a link to fdisk. 6 6 7 Thus mindi/mondorestore commands launched by root will pass all their call to mr _parted2fdisk on ia64 instead of the real fdisk, and be able to support the GPT format. It will call fdisk and parted for its work. (Note again that on ia32 parte2fdisk is in fact a link to fdisk to avoid any compatibility issue)7 Thus mindi/mondorestore commands launched by root will pass all their call to mr-parted2fdisk on ia64 instead of the real fdisk, and be able to support the GPT format. It will call fdisk and parted for its work. (Note again that on ia32 parte2fdisk is in fact a link to fdisk to avoid any compatibility issue) 8 8 9 9 The install.sh script will setup everything correctly for you. 10 10 11 Note that mr _parted2fdisk supports currently only the -l and -s options as well as the commands p,n,d,w,t,a,q11 Note that mr-parted2fdisk supports currently only the -l and -s options as well as the commands p,n,d,w,t,a,q 12 12 13 13 On Itanium systems you won't generally find an installed isolinux.bin file which is required by mindi to create the bootable images. You'll generally have to take an i386 package for your distribution and install it on your itanium system so that you provide the required missing file. … … 18 18 Bruno. 19 19 20 2015-03-21 tool renamed to mr _parted2fdisk20 2015-03-21 tool renamed to mr-parted2fdisk 21 21 2013-06-08 no binary made anymore, only perl scripts 22 22 2005-12-12 parted2fdisk used everywhere -
branches/3.2/mindi/install.sh
r3371 r3377 95 95 96 96 # Manage perl script man pages 97 for s in mindi-bkphw mindi-get-perl-modules mr _parted2fdisk; do97 for s in mindi-bkphw mindi-get-perl-modules mr-parted2fdisk; do 98 98 install -m 755 $s $SBINDIR 99 99 pod2man -c "$s a MondoRescue tool" --section=8 --release="$VERSTR" $SBINDIR/$s > $s.8 … … 109 109 fi 110 110 111 # Managing mr _parted2fdisk112 (cd $SBINDIR && install -m 755 mr _parted2fdisk $locallib/mindi/rootfs/usr/sbin/mr_parted2fdisk)111 # Managing mr-parted2fdisk 112 (cd $SBINDIR && install -m 755 mr-parted2fdisk $locallib/mindi/rootfs/usr/sbin/mr-parted2fdisk) 113 113 114 114 if [ "$PKGBUILDMINDI" != "true" ]; then 115 115 chown -R root:root $locallib/mindi $conf # $DOCDIR 116 chown root:root $SBINDIR/mindi $MANDIR/mindi.8 $locallib/mindi/analyze-my-lvm $SBINDIR/mr _parted2fdisk116 chown root:root $SBINDIR/mindi $MANDIR/mindi.8 $locallib/mindi/analyze-my-lvm $SBINDIR/mr-parted2fdisk 117 117 fi 118 118 -
branches/3.2/mindi/mindi
r3372 r3377 100 100 \n0eF107-Main | Boot Parameters 0eF207-1/2 | 0eF307-2/2 | 0eF407-PXE\n\ 101 101 " 102 FDISK=$MINDI_SBIN/mr _parted2fdisk102 FDISK=$MINDI_SBIN/mr-parted2fdisk 103 103 104 104 # Using a config file allow to overwrite some values -
branches/3.2/mindi/mr-parted2fdisk
r3376 r3377 3 3 # $Id$ 4 4 # 5 # mr _parted2fdisk: fdisk like interface for parted5 # mr-parted2fdisk: fdisk like interface for parted 6 6 # [developed for mindi/mondo http://www.mondorescue.org] 7 7 # … … 27 27 =head1 NAME 28 28 29 mr _parted2fdisk is a fdisk like command using parted internally for analysing GPT labelled disks29 mr-parted2fdisk is a fdisk like command using parted internally for analysing GPT labelled disks 30 30 31 31 =head1 DESCRIPTION 32 32 33 mr _parted2fdisk behaves like the fdisk command, but dialog internally with parted in order to manipulate partition tables, which allow it to support GPT partition format as well as MBR, contrary to fdisk. It aims at providing compatible external interface with fdisk. Developed initialy for ia64 Linux, it is also useful now on x86 systems using GPT partition format (for large HDDs).33 mr-parted2fdisk behaves like the fdisk command, but dialog internally with parted in order to manipulate partition tables, which allow it to support GPT partition format as well as MBR, contrary to fdisk. It aims at providing compatible external interface with fdisk. Developed initialy for ia64 Linux, it is also useful now on x86 systems using GPT partition format (for large HDDs). 34 34 35 35 =head1 SYNOPSIS 36 36 37 mr _parted2fdisk -s partition38 39 mr _parted2fdisk -l [device]40 41 mr _parted2fdisk [-n] device37 mr-parted2fdisk -s partition 38 39 mr-parted2fdisk -l [device] 40 41 mr-parted2fdisk [-n] device 42 42 43 43 =head1 OPTIONS … … 56 56 57 57 Fake mode. Doesn't pass the commands just simulate. 58 59 =item B<-v> 60 61 Verbose mode. Used to help debugging issues. 58 62 59 63 =item B<no option> … … 102 106 103 107 # Log 104 my $flog = "/var/log/mr _parted2fdisk.log";108 my $flog = "/var/log/mr-parted2fdisk.log"; 105 109 open(FLOG, "> $flog") || die "Unable to open $flog"; 106 110 … … 133 137 my $device; 134 138 my $endmax = ""; 135 my $appname = "mr _parted2fdisk";139 my $appname = "mr-parted2fdisk"; 136 140 my ($mrver,$mrrev) = mr_version_init(); 137 141 -
branches/3.2/mondo/src/common/libmondo-devices.c
r3375 r3377 327 327 #else 328 328 return 329 !system("mr _parted2fdisk -l 2>/dev/null | grep '^/dev/' | grep -Eqv '(MS|DOS|EFI|FAT|NTFS)'");329 !system("mr-parted2fdisk -l 2>/dev/null | grep '^/dev/' | grep -Eqv '(MS|DOS|EFI|FAT|NTFS)'"); 330 330 #endif 331 331 } … … 364 364 #endif 365 365 366 mr_asprintf(program, "mr _parted2fdisk -l %s 2> /dev/null", drive);366 mr_asprintf(program, "mr-parted2fdisk -l %s 2> /dev/null", drive); 367 367 fin = popen(program, "r"); 368 368 if (!fin) { … … 1729 1729 * Either way, it's an error. 1730 1730 ********/ 1731 mr_asprintf(command, "mr _parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);1731 mr_asprintf(command, "mr-parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf); 1732 1732 log_msg(5, "Executing: %s", command); 1733 1733 mr_asprintf(partition_list, "%s", call_program_and_get_last_line_of_output(command)); … … 1795 1795 log_msg(4, "Processing partition: %s", partitions[i]); 1796 1796 /* See if it's swap. If it is, ignore it. */ 1797 mr_asprintf(command, "mr _parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'", ndsf, partitions[i]);1797 mr_asprintf(command, "mr-parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'", ndsf, partitions[i]); 1798 1798 log_msg(5, " Running: %s", command); 1799 1799 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); … … 2110 2110 2111 2111 t_boot ret = BIOS; 2112 FILE*fd = NULL;2112 DIR *fd = NULL; 2113 2113 2114 2114 #ifdef __IA64__ … … 2116 2116 #endif 2117 2117 /* Try to detect whether we are in fact in UEFI mode */ 2118 /* TODO: find the right trigger */ 2119 fd = fopen("/sys/module/efi", "r"); 2118 fd = opendir("/sys/firmware/efi", "r"); 2120 2119 if (fd != NULL) { 2121 2120 ret = UEFI; 2121 closedir(fd); 2122 2122 } 2123 2123 return(ret); … … 2365 2365 mr_free(tmp); 2366 2366 2367 if (!popup_and_get_string("Tape block size?", "What is the block size of your tape streamer?", sz_size, 15)) { 2367 mr_asprintf(sz_size,"%s",bkpinfo->internal_tape_block_size); 2368 tmp = mr_popup_and_get_string("Tape block size?", "What is the block size of your tape streamer?", sz_size); 2369 if (tmp == NULL) { 2368 2370 log_to_screen("User has chosen not to backup the PC"); 2369 2371 finish(1); 2370 2372 } 2371 bkpinfo->internal_tape_block_size = atol(sz_size); 2373 bkpinfo->internal_tape_block_size = atol(tmp); 2374 mr_free(sz_size); 2375 mr_free(tmp); 2376 2372 2377 if (bkpinfo->internal_tape_block_size <= 0) { 2373 2378 log_to_screen("User has chosen not to backup the PC"); … … 2682 2687 mr_free(tmp); 2683 2688 // NTFS 2684 strcpy(tmp1, call_program_and_get_last_line_of_output("mr _parted2fdisk -l 2>/dev/null | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));2689 strcpy(tmp1, call_program_and_get_last_line_of_output("mr-parted2fdisk -l 2>/dev/null | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'")); 2685 2690 if (strlen(tmp1) > 2) { 2686 2691 if (!popup_and_get_string("NTFS partitions", "Please enter/confirm the NTFS partitions you wish to backup as well.", tmp1, MAX_STR_LEN / 4)) { … … 3100 3105 assert(which_device != NULL); 3101 3106 3102 mr_asprintf(list_drives_cmd, "mr _parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", where_is_root_mounted());3107 mr_asprintf(list_drives_cmd, "mr-parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", where_is_root_mounted()); 3103 3108 log_it("list_drives_cmd = %s", list_drives_cmd); 3104 3109 … … 3142 3147 } else { 3143 3148 // We need to look on each partition then 3144 mr_asprintf(list_drives_cmd, "mr _parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");3149 mr_asprintf(list_drives_cmd, "mr-parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/"); 3145 3150 log_it("list_drives_cmd = %s", list_drives_cmd); 3146 3151 … … 3290 3295 struct stat buf; 3291 3296 #endif 3292 mr_asprintf(command, "mr _parted2fdisk -l %s 2>/dev/null | grep 'EFI GPT'", drive);3297 mr_asprintf(command, "mr-parted2fdisk -l %s 2>/dev/null | grep 'EFI GPT'", drive); 3293 3298 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 3294 3299 mr_free(command); -
branches/3.2/mondo/src/common/libmondo-string.c
r3290 r3377 69 69 } 70 70 71 72 /** 73 * Pad a string on both sides so it appears centered. 74 * @param in_out The string to be center-padded (modified). 75 * @param width The width of the final result. 76 */ 77 char *mr_center_string(char *in, int width) 78 { 79 char *scratch = NULL; 80 char *out = NULL; 81 int i; /* purpose */ 82 int len; /* purpose */ 83 int mid; /* purpose */ 84 int x; /* purpose */ 85 86 assert(in != NULL); 87 assert(width > 2); 88 89 if (strlen(in) == 0) { 90 return(NULL); 91 } 92 /* skip initial spaces */ 93 mr_asprintf(scratch, "%s", in); 94 mr_strip_spaces(scratch); 95 len = (int)strlen(scratch); 96 mid = width / 2; 97 x = mid - len / 2; 98 for (i = 0; i < x; i++) { 99 mr_strcat(out,' '); 100 } 101 mr_strcat(out, scratch); 102 mr_free(scratch); 103 for (i = x + len ; i < width - 1; i++) { 104 mr_strcat(out,' '); 105 } 106 return(out); 107 } 71 108 72 109 /** -
branches/3.2/mondo/src/common/libmondo-tools.c
r3375 r3377 993 993 mr_free(tmp); 994 994 995 if (!run_program_and_log_output("mr _parted2fdisk -l 2>/dev/null | grep -i raid", 1) && !does_file_exist("/etc/raidtab")) {995 if (!run_program_and_log_output("mr-parted2fdisk -l 2>/dev/null | grep -i raid", 1) && !does_file_exist("/etc/raidtab")) { 996 996 log_to_screen("You have RAID partitions but no /etc/raidtab - creating one from /proc/mdstat"); 997 997 create_raidtab_from_mdstat(MDSTAT_FILE,"/etc/raidtab"); -
branches/3.2/mondo/src/common/newt-specific.c
r3292 r3377 717 717 } 718 718 } 719 720 /** 721 * Ask the user to enter a value. 722 * @param title The title of the dialog box. 723 * @param b The blurb (e.g. what you want the user to enter). 724 * @param input The string to initialize the user's answer with. 725 * @return value needs to be freed up by caller 726 */ 727 char *mr_popup_and_get_string(char *title, char *b, char *input) { 728 729 /*@ newt ************************************************************ */ 730 newtComponent myForm; 731 newtComponent b_1; 732 newtComponent b_2; 733 newtComponent b_res; 734 newtComponent text; 735 newtComponent type_here; 736 737 char *entry_value = NULL; 738 char *blurb = NULL; 739 char *out = NULL; 740 741 assert_string_is_neither_NULL_nor_zerolength(title); 742 assert(b != NULL); 743 744 if (g_text_mode) { 745 printf("---promptstring---1--- %s\n---promptstring---2--- %s\n---promptstring---Q---\n--> ", title, b); 746 mr_getline(out, stdin); 747 if (out[strlen(out) - 1] == '\n') 748 out[strlen(out) - 1] = '\0'; 749 return(out); 750 } 751 752 assert(input != NULL); 753 text = newtTextboxReflowed(2, 1, b, 48, 5, 5, 0); 754 type_here = newtEntry(2, newtTextboxGetNumLines(text) + 2, input, 50, (void *) &entry_value, NEWT_FLAG_RETURNEXIT); 755 b_1 = newtButton(6, newtTextboxGetNumLines(text) + 4, " OK "); 756 b_2 = newtButton(18, newtTextboxGetNumLines(text) + 4, "Cancel"); 757 newtCenteredWindow(54, newtTextboxGetNumLines(text) + 9, title); 758 myForm = newtForm(NULL, NULL, 0); 759 newtFormAddComponents(myForm, text, type_here, b_1, b_2, NULL); 760 blurb = mr_center_string(b, 80); 761 newtPushHelpLine(blurb); 762 b_res = newtRunForm(myForm); 763 764 newtPopHelpLine(); 765 newtFormDestroy(myForm); 766 newtPopWindow(); 767 mr_free(blurb); 768 769 if (b_res != b_2) { 770 out = entry_value; 771 } 772 return(out); 773 } 719 774 720 775 /** -
branches/3.2/mondo/src/mondorestore/mondo-prep.c
r3371 r3377 1347 1347 #else 1348 1348 make_hole_for_file(FDISK_LOG); 1349 mr_asprintf(tmp, "mr _parted2fdisk %s >> %s 2>> %s", drivename, FDISK_LOG, FDISK_LOG);1349 mr_asprintf(tmp, "mr-parted2fdisk %s >> %s 2>> %s", drivename, FDISK_LOG, FDISK_LOG); 1350 1350 pout_to_fdisk = popen(tmp, "w"); 1351 1351 if (!pout_to_fdisk) { 1352 log_to_screen("Cannot call mr _parted2fdisk to configure %s", drivename);1352 log_to_screen("Cannot call mr-parted2fdisk to configure %s", drivename); 1353 1353 mr_free(tmp); 1354 1354 return (1); … … 1587 1587 1588 1588 1589 mr_asprintf(program, "mr _parted2fdisk %s >> %s 2>> %s", drive, MONDO_LOGFILE, MONDO_LOGFILE);1589 mr_asprintf(program, "mr-parted2fdisk %s >> %s 2>> %s", drive, MONDO_LOGFILE, MONDO_LOGFILE); 1590 1590 1591 1591 /* BERLIOS: should not be called each time */ … … 1906 1906 } else { 1907 1907 mr_asprintf(output, "t\n%d\n%s\nw\n", partno, partcode); 1908 mr_asprintf(command, "mr _parted2fdisk %s >> %s 2>> %s", drive, MONDO_LOGFILE, MONDO_LOGFILE);1908 mr_asprintf(command, "mr-parted2fdisk %s >> %s 2>> %s", drive, MONDO_LOGFILE, MONDO_LOGFILE); 1909 1909 log_msg(5, "output = '%s'", output); 1910 1910 log_msg(5, "partno=%d; partcode=%s", partno, partcode); -
branches/3.2/mondo/src/restore-scripts/mondo/format-and-kludge-vfat
r3371 r3377 28 28 device=$1 29 29 drive=$2 30 ftype=`mr _parted2fdisk -l $drive 2>/dev/null | grep $device | tr '*' ' ' | tr -s '\t' ' ' | cut -d' ' -f5`30 ftype=`mr-parted2fdisk -l $drive 2>/dev/null | grep $device | tr '*' ' ' | tr -s '\t' ' ' | cut -d' ' -f5` 31 31 case $ftype in 32 32 # "b" | "c") -
branches/3.2/mondo/src/restore-scripts/mondo/grub-MR
r3371 r3377 169 169 line=`grep $base /proc/mdstat | head -n1` 170 170 echo "mbrdev was $mbrdev" 2>&1 | tee -a $LOGFILE 171 mbrdev=`mr _parted2fdisk -l 2>/dev/null | grep /dev/ | head -n1 | tr ':' ' ' | cut -d' ' -f2`171 mbrdev=`mr-parted2fdisk -l 2>/dev/null | grep /dev/ | head -n1 | tr ':' ' ' | cut -d' ' -f2` 172 172 echo "mbrdev is $mbrdev" 2>&1 | tee -a $LOGFILE 173 173 partno="0"; # cheating - FIXME -
branches/3.2/mondo/src/restore-scripts/mondo/make-me-bootable
r3371 r3377 17 17 dummy="$3" 18 18 19 activepart=`mr _parted2fdisk -l $drivetouse 2>/dev/null | tr -s '\t' ' ' | grep "$drivetouse" | grep '*' | cut -d' ' -f1`19 activepart=`mr-parted2fdisk -l $drivetouse 2>/dev/null | tr -s '\t' ' ' | grep "$drivetouse" | grep '*' | cut -d' ' -f1` 20 20 21 21 for i in `cat $1 | tr -s '\t' ' ' | cut -d' ' -f1 | grep -vE "/dev/fd|none|#"` ; do … … 66 66 echo "Would activate $partno on $drive" >> $LOGFILE 67 67 else 68 echo -en "${cmd}a\n$partno\np\nw\n" | mr _parted2fdisk $drive >> $LOGFILE 2>> $LOGFILE68 echo -en "${cmd}a\n$partno\np\nw\n" | mr-parted2fdisk $drive >> $LOGFILE 2>> $LOGFILE 69 69 fi 70 70 fi
Note:
See TracChangeset
for help on using the changeset viewer.