Changeset 3371 in MondoRescue


Ignore:
Timestamp:
Apr 18, 2015, 7:15:32 PM (9 years ago)
Author:
Bruno Cornec
Message:
  • Rename mindi/parted2fdisk.pl into mindi/mr_parted2fdisk and make all adaptations required
Location:
branches/3.2
Files:
10 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi/README.ia64

    r3136 r3371  
    33Linux 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.
    44
    5 So a perl script called parted2fdisk.pl 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, parted2fdisk is a link to fdisk.
     5So 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.
    66
    7 Thus mindi/mondorestore commands launched by root will pass all their call to 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)
     7Thus 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)
    88
    99The install.sh script will setup everything correctly for you.
    1010
    11 Note that parted2fdisk.pl supports currently only the -l and -s options as well as the commands p,n,d,w,t,a,q
     11Note that mr_parted2fdisk supports currently only the -l and -s options as well as the commands p,n,d,w,t,a,q
    1212
    1313On 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.
     
    1818Bruno.
    1919
     202015-03-21 tool renamed to mr_parted2fdisk
    20212013-06-08 no binary made anymore, only perl scripts
    21222005-12-12 parted2fdisk used everywhere
  • branches/3.2/mindi/install.sh

    r3361 r3371  
    9595
    9696# Manage perl script man pages
    97 for s in mindi-bkphw mindi-get-perl-modules parted2fdisk.pl; do
     97for s in mindi-bkphw mindi-get-perl-modules mr_parted2fdisk; do
    9898    install -m 755 $s $SBINDIR
    9999    pod2man -c "$s a MondoRescue tool" --section=8 --release="$VERSTR" $SBINDIR/$s > $s.8
     
    104104EOF
    105105done
    106 (cd $MANDIR ; if [ ! -f parted2fdisk.9 ]; then ln -s parted2fdisk.pl.8 parted2fdisk.9; fi)
    107106
    108107if [ "_$PREFIX" = "_" ] && [ ! -f $locallib/mindi/rootfs/bin/busybox ]; then
     
    110109fi
    111110
    112 # Managing parted2fdisk
    113 (cd $SBINDIR && ln -sf parted2fdisk.pl parted2fdisk && install -m 755 parted2fdisk.pl $locallib/mindi/rootfs/usr/sbin/parted2fdisk)
     111# Managing mr_parted2fdisk
     112(cd $SBINDIR && install -m 755 mr_parted2fdisk $locallib/mindi/rootfs/usr/sbin/mr_parted2fdisk)
    114113
    115114if [ "$PKGBUILDMINDI" != "true" ]; then
    116115    chown -R root:root $locallib/mindi $conf # $DOCDIR
    117     chown root:root $SBINDIR/mindi $MANDIR/mindi.8 $locallib/mindi/analyze-my-lvm $SBINDIR/parted2fdisk.pl
     116    chown root:root $SBINDIR/mindi $MANDIR/mindi.8 $locallib/mindi/analyze-my-lvm $SBINDIR/mr_parted2fdisk
    118117fi
    119118
  • branches/3.2/mindi/mindi

    r3368 r3371  
    100100\n0eF107-Main | Boot Parameters 0eF207-1/2 | 0eF307-2/2 | 0eF407-PXE\n\
    101101"
    102 FDISK=$MINDI_SBIN/parted2fdisk
     102FDISK=$MINDI_SBIN/mr_parted2fdisk
    103103
    104104# Using a config file allow to overwrite some values
  • branches/3.2/mindi/mr_parted2fdisk

    r3370 r3371  
    33# $Id$
    44#
    5 # parted2fdisk: fdisk like interface for parted
     5# mr_parted2fdisk: fdisk like interface for parted
    66# [developed for mindi/mondo http://www.mondorescue.org]
    77#
     
    2727=head1 NAME
    2828
    29 parted2fdisk is a fdisk like command using parted internally for analysing GPT labelled disks
     29mr_parted2fdisk is a fdisk like command using parted internally for analysing GPT labelled disks
    3030
    3131=head1 DESCRIPTION
    3232
    33 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).
     33mr_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).
    3434
    3535=head1 SYNOPSIS
    3636
    37 parted2fdisk -s partition
    38 
    39 parted2fdisk -l [device]
    40 
    41 parted2fdisk [-n] device
     37mr_parted2fdisk -s partition
     38
     39mr_parted2fdisk -l [device]
     40
     41mr_parted2fdisk [-n] device
    4242
    4343=head1 OPTIONS
     
    102102
    103103# Log
    104 my $flog = "/var/log/parted2fdisk.log";
     104my $flog = "/var/log/mr_parted2fdisk.log";
    105105open(FLOG, "> $flog") || die "Unable to open $flog";
    106106
     
    133133my $device;
    134134my $endmax = "";
    135 my $appname = "parted2fdisk";
     135my $appname = "mr_parted2fdisk";
    136136my ($mrver,$mrrev) = mr_version_init();
    137137
  • branches/3.2/mondo-doc/mondoarchive.8

    r3322 r3371  
    399399.IR ARCH
    400400This variable is passed to the environment by mondoarchive so that
    401 parted2fdisk.pl is aware of the underlying hardware architecture.
     401other tools are aware of the underlying hardware architecture.
    402402
    403403.IR MONDO_SHARE
  • branches/3.2/mondo/src/common/libmondo-devices.c

    r3352 r3371  
    324324#if __FreeBSD__
    325325    return
    326         !system
    327         ("for drive in /dev/ad? /dev/da?; do fdisk $drive | grep -q FreeBSD && exit 0; done; false");
     326        !system("for drive in /dev/ad? /dev/da?; do fdisk $drive | grep -q FreeBSD && exit 0; done; false");
    328327#else
    329328    return
    330         !system
    331         ("parted2fdisk -l 2>/dev/null | grep '^/dev/' | grep -Eqv '(MS|DOS|FAT|NTFS)'");
     329        !system("mr_parted2fdisk -l 2>/dev/null | grep '^/dev/' | grep -Eqv '(MS|DOS|EFI|FAT|NTFS)'");
    332330#endif
    333331}
     
    366364#endif
    367365
    368     mr_asprintf(program, "parted2fdisk -l %s 2> /dev/null", drive);
     366    mr_asprintf(program, "mr_parted2fdisk -l %s 2> /dev/null", drive);
    369367    fin = popen(program, "r");
    370368    if (!fin) {
     
    17311729    * Either way, it's an error.
    17321730    ********/
    1733     mr_asprintf(command, "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);
    17341732    log_msg(5, "Executing: %s", command);
    17351733    mr_asprintf(partition_list, "%s", call_program_and_get_last_line_of_output(command));
     
    17971795        log_msg(4, "Processing partition: %s", partitions[i]);
    17981796        /* See if it's swap. If it is, ignore it. */
    1799         mr_asprintf(command, "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]);
    18001798        log_msg(5, "  Running: %s", command);
    18011799        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
     
    26632661        mr_free(tmp);
    26642662// NTFS
    2665         strcpy(tmp1, call_program_and_get_last_line_of_output("parted2fdisk -l 2>/dev/null | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));
     2663        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};'"));
    26662664        if (strlen(tmp1) > 2) {
    26672665            if (!popup_and_get_string("NTFS partitions", "Please enter/confirm the NTFS partitions you wish to backup as well.", tmp1, MAX_STR_LEN / 4)) {
     
    30813079    assert(which_device != NULL);
    30823080
    3083     mr_asprintf(list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", where_is_root_mounted());
     3081    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());
    30843082    log_it("list_drives_cmd = %s", list_drives_cmd);
    30853083
     
    31233121    } else {
    31243122        // We need to look on each partition then
    3125         mr_asprintf(list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
     3123        mr_asprintf(list_drives_cmd, "mr_parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
    31263124        log_it("list_drives_cmd = %s", list_drives_cmd);
    31273125
     
    32713269    struct stat buf;
    32723270#endif
    3273     mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null | grep 'EFI GPT'", drive);
     3271    mr_asprintf(command, "mr_parted2fdisk -l %s 2>/dev/null | grep 'EFI GPT'", drive);
    32743272    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    32753273    mr_free(command);
  • branches/3.2/mondo/src/common/libmondo-tools.c

    r3318 r3371  
    992992    mr_free(tmp);
    993993
    994     if (!run_program_and_log_output("parted2fdisk -l 2>/dev/null | grep -i raid", 1) && !does_file_exist("/etc/raidtab")) {
     994    if (!run_program_and_log_output("mr_parted2fdisk -l 2>/dev/null | grep -i raid", 1) && !does_file_exist("/etc/raidtab")) {
    995995        log_to_screen("You have RAID partitions but no /etc/raidtab - creating one from /proc/mdstat");
    996996        create_raidtab_from_mdstat(MDSTAT_FILE,"/etc/raidtab");
  • branches/3.2/mondo/src/mondorestore/mondo-prep.c

    r3330 r3371  
    13471347#else
    13481348make_hole_for_file(FDISK_LOG);
    1349 mr_asprintf(tmp, "parted2fdisk %s >> %s 2>> %s", drivename, FDISK_LOG, FDISK_LOG);
     1349mr_asprintf(tmp, "mr_parted2fdisk %s >> %s 2>> %s", drivename, FDISK_LOG, FDISK_LOG);
    13501350pout_to_fdisk = popen(tmp, "w");
    13511351if (!pout_to_fdisk) {
    1352     log_to_screen("Cannot call parted2fdisk to configure %s", drivename);
     1352    log_to_screen("Cannot call mr_parted2fdisk to configure %s", drivename);
    13531353    mr_free(tmp);
    13541354    return (1);
     
    15871587
    15881588
    1589 mr_asprintf(program, "parted2fdisk %s >> %s 2>> %s", drive, MONDO_LOGFILE, MONDO_LOGFILE);
     1589mr_asprintf(program, "mr_parted2fdisk %s >> %s 2>> %s", drive, MONDO_LOGFILE, MONDO_LOGFILE);
    15901590
    15911591/* BERLIOS: should not be called each time */
     
    19061906    } else {
    19071907        mr_asprintf(output, "t\n%d\n%s\nw\n", partno, partcode);
    1908         mr_asprintf(command, "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);
    19091909        log_msg(5, "output = '%s'", output);
    19101910        log_msg(5, "partno=%d; partcode=%s", partno, partcode);
  • branches/3.2/mondo/src/restore-scripts/mondo/format-and-kludge-vfat

    r3318 r3371  
    2828    device=$1
    2929    drive=$2
    30     ftype=`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`
    3131    case $ftype in
    3232#   "b" | "c")
  • branches/3.2/mondo/src/restore-scripts/mondo/grub-MR

    r3318 r3371  
    169169    line=`grep $base /proc/mdstat | head -n1`
    170170    echo "mbrdev was $mbrdev" 2>&1 | tee -a $LOGFILE
    171     mbrdev=`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`
    172172    echo "mbrdev is $mbrdev" 2>&1 | tee -a $LOGFILE
    173173    partno="0"; # cheating - FIXME   
  • branches/3.2/mondo/src/restore-scripts/mondo/make-me-bootable

    r3318 r3371  
    1717dummy="$3"
    1818
    19 activepart=`parted2fdisk -l $drivetouse 2>/dev/null | tr -s '\t' ' ' | grep "$drivetouse" | grep '*' | cut -d' ' -f1`
     19activepart=`mr_parted2fdisk -l $drivetouse 2>/dev/null | tr -s '\t' ' ' | grep "$drivetouse" | grep '*' | cut -d' ' -f1`
    2020
    2121for i in `cat $1 | tr -s '\t' ' ' | cut -d' ' -f1 | grep -vE "/dev/fd|none|#"` ; do
     
    6666        echo "Would activate $partno on $drive" >> $LOGFILE
    6767    else
    68         echo -en "${cmd}a\n$partno\np\nw\n" | parted2fdisk $drive >> $LOGFILE 2>> $LOGFILE
     68        echo -en "${cmd}a\n$partno\np\nw\n" | mr_parted2fdisk $drive >> $LOGFILE 2>> $LOGFILE
    6969    fi
    7070fi
Note: See TracChangeset for help on using the changeset viewer.