Changeset 196


Ignore:
Timestamp:
Dec 14, 2005, 12:04:21 AM (14 years ago)
Author:
bcornec
Message:

Usage of parted2fdisk instead of fdisk everywhere.
on ia64 this is mandatory, and simplifies the infrastructure
on other archs, it doesn't change anything as parted2fdisk here is a link to fdisk

Location:
branches/2.05
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • branches/2.05/mindi/CHANGES

    r195 r196  
    1313- manage non ambiguous delivery under /usr (packages) or /usr/local (tar ball)
    1414  (Bruno Cornec)
     15- use parted2fdisk everywhere (Bruno Cornec)
    1516
    16171.05 (2005-11-19)
  • branches/2.05/mindi/README.ia64

    r193 r196  
    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 I've written a perl script called parted2fdisk.pl 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.
     5So 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.
    66
    7 To use it on the system to backup, please do the following as root:
    8 
    9 mv /sbin/fdisk /usr/local/bin/fdisk
    10 ln -sf /sbin/parted2fdisk.pl /sbin/fdisk
    11 Verify that /usr/local/bin is in your path or add it.
    12 
    13 The mindi.rpm package will do that automatically for you.
    14 
    15 Thus mindi/mondo launched by root will smoothly pass all their call to parted2fdisk.pl instead of the real fdisk, and be able to support the GPT format.
    16 The existing fdisk command on your system needs to remain accessible in your path as parted2fdisk.pl uses it.
     7Thus mindi/mondo launched by root will pass all their call to parted2fdisk instead of the real fdisk, and be able to support the GPT format. It will call fdisk and parted for its work.
    178
    189To get it on the system to restore, please do the following as root:
     
    2213mv rootfs/sbin/parted2fdisk-ia64 rootfs/sbin/parted2fdisk
    2314
    24 This will produce a binary version that will be used by mondorestore during the restoration process on ia64 to handle the GPT format. (Note that on ia32 parte2fdisk is in fact a link to fdisk to avoid any compatibility issue)
    25 So in the restoration environment on ia64, /sbin/fdisk is in fact the result of the compilation of parted2fdisk, and the real ia64 fdisk is placed under /usr/local/bin (result of the previous setup on the machine to backup)
     15This will produce a binary version that will be used by mondorestore during the restoration process on ia64 to handle the GPT format. (Note again that on ia32 parte2fdisk is in fact a link to fdisk to avoid any compatibility issue)
    2616
    27 Again the mindi.rpm package will do that automatically for you.
     17The install.sh script will setup everything correctly for you.
    2818
    2919Note that parted2fdisk.pl supports currently only the -l and -s options as well as the commands p,n,d,w,t,a,q
    3020
    31 Please report any problem around that tool to bruno.cornec@hp.com
     21Please report any problem around that tool to bcornec@users.berlios.de
    3222Bruno.
    3323
     242005-12-12 parted2fdisk used everywhere
    34252005-03-23 Explain compilation and backup/restore split
    35262004-09-16 Initial file
  • branches/2.05/mindi/aux-tools/sbin/calc-disk-size

    r30 r196  
    66CalcDiskSize() {
    77    local res cylinders sectorsize disksize i curr stub out
    8     res=`fdisk -l $1 2> /dev/null | grep -i "cylinders of"`
     8    res=`parted2fdisk -l $1 2> /dev/null | grep -i "cylinders of"`
    99    cylinders=`echo "$res" | cut -d' ' -f5`
    1010    sectorsize=`echo "$res" | cut -d' ' -f7`
    11     cylindermod=`fdisk -l $1 2> /dev/null | grep -i $1:`; # note colon at end to make sure it's not the /dev/sda# partition info
     11    cylindermod=`parted2fdisk -l $1 2> /dev/null | grep -i $1:`; # note colon at end to make sure it's not the /dev/sda# partition info
    1212    cylnum=`echo "$cylindermod" | cut -d' ' -f7`
    1313    predisksize=$(($cylinders*$sectorsize/1024))
  • branches/2.05/mindi/aux-tools/sbin/format-and-kludge-vfat

    r85 r196  
    2828    device=$1
    2929    drive=$2
    30     ftype=`fdisk -l $drive | grep $device | tr '*' ' ' | tr -s '\t' ' ' | cut -d' ' -f5`
     30    ftype=`parted2fdisk -l $drive | grep $device | tr '*' ' ' | tr -s '\t' ' ' | cut -d' ' -f5`
    3131    case $ftype in
    3232#   "b" | "c")
  • branches/2.05/mindi/deplist.txt

    r30 r196  
    4545ping devfsd burnBX burnK6 burnK7 burnMMX burnP5 burnP6 lucifer tiobench tiotest bonnie++ mprime ide-smart
    4646
    47 # For ia64
    48 /usr/local/bin/fdisk
    49 
    5047# ------------------------------- for X (Hugo) --------------------------------
    5148#tar
  • branches/2.05/mindi/install.sh

    r191 r196  
    7171
    7272if [ "$ARCH" = "i386" ] ; then
     73    (cd $local/sbin && ln -s fdisk parted2fdisk)
    7374    if [ -f $local/lib/mindi/rootfs/bin/busybox-$ARCH.net ]; then
    7475        echo "Installing busybox.net ..."
     
    8081
    8182if [ "$ARCH" = "ia64" ] ; then
     83    (cd $local/sbin && ln -s parted2fdisk.pl parted2fdisk)
    8284    make -f Makefile.parted2fdisk DEST=$local/lib/mindi install
    8385    if [ -f $local/lib/mindi/rootfs/sbin/parted2fdisk-$ARCH ]; then
  • branches/2.05/mindi/mindi

    r179 r196  
    132132    which afio > /dev/null 2> /dev/null || LogIt "afio not found... mindi doesn't need afio but Mondo does... Be aware...\n"
    133133    [ ! -e "/etc/issue.net" ] && > /etc/issue.net
    134     FDISK=$MINDI_SBIN/parted2fdisk.pl
     134    FDISK=$MINDI_SBIN/parted2fdisk
    135135    FDISKLOG=/tmp/parted2fdisk.log
    136136    touch $FDISKLOG
     
    12071207   AddFileToCfgIfExists $MONDO_TMP/NFS-CLIENT-IPADDR nfs-client-ipaddr $outfile
    12081208   AddFileToCfgIfExists $MONDO_TMP/NFS-CLIENT-NETMASK nfs-client-netmask $outfile
     1209   AddFileToCfgIfExists $MONDO_TMP/NFS-CLIENT-BROADCAST nfs-client-broadcast $outfile
    12091210   AddFileToCfgIfExists $MONDO_TMP/NFS-CLIENT-DEFGW  nfs-client-defgw  $outfile
    12101211   AddFileToCfgIfExists $MONDO_TMP/NFS-SERVER-MOUNT  nfs-server-mount  $outfile
     
    13271328    all_partitions=""
    13281329   
    1329 # Workaround until fdisk2parted.pl is fixed
    1330     [ "$ARCH" != "ia64" ] && FDISK=`which fdisk`
    1331 # End workaround - Hugo, 06/20/2004
    1332 
    13331330    if [ -d "/proc/lvm" ] || [ -d "/dev/mapper" ]; then
    13341331    echo -en "\rAnalyzing LVM...\r"
  • branches/2.05/mindi/mindi.spec

    r189 r196  
    7878    echo "WARNING: /usr/local/sbin/mindi exists. You should probably remove your manual mindi installation !"
    7979fi
    80 
    81 %ifarch ia64
    82     %{__mkdir_p} /usr/local/bin
    83     if [ "`file /sbin/fdisk |grep 'LF 64-bit LSB executable'`" ] ; then
    84         %{__cp} /sbin/fdisk /sbin/fdisk.mondosav
    85         %{__mv} /sbin/fdisk /usr/local/bin/fdisk
    86         %{__ln_s} -f /usr/sbin/parted2fdisk.pl /sbin/fdisk
    87         echo "Warning: you fdisk binary is now under /usr/local/bin"
    88     fi
    89 %endif
    9080
    9181%files
  • branches/2.05/mindi/parted2fdisk.pl

    r90 r196  
    306306my $cmd = shift;
    307307my $basename = basename($cmd);
    308 my $mindifdisk="/usr/local/bin/fdisk";
    309 
    310 if ($cmd =~ /fdisk/) {
    311     if ($arch =~ /^ia64/) {
    312         if (-l $cmd) {
    313             print FLOG "Your system is ready for mondo-archive on ia64\n";
    314         } else {
    315             print FLOG "Your system is ready for mondo-restore on ia64\n";
    316         }
    317         if (-x $mindifdisk) {
    318             $cmd = $mindifdisk;
    319         } else {
    320             print FLOG "Your system doesn't provide $mindifdisk\n";
    321             print FLOG "Please use mindi-x.yz-ia64.rpm on the system to backup\n";
    322             myexit(-1);
    323         }
    324     }
    325 }
     308
    326309if (not (-x $cmd)) {
    327310    print FLOG "Your system is not LSB/mondo compliant: $basename was not found as $cmd\n";
  • branches/2.05/mindi/rootfs/sbin/init

    r180 r196  
    678678    cp -af /dev/md2 /dev/md/2 2> /dev/null
    679679fi
    680 # As described in the README.ia64 we replaced on the native system
    681 # /sbin/fdisk by parted2fdisk.pl now we need the reverse for mindi's
    682 # boot environment
    683680export ARCH=`/bin/arch`
    684 if [ "$ARCH" = "ia64" ] ; then
    685     rm -f /sbin/fdisk
    686     ln /sbin/parted2fdisk /sbin/fdisk
    687 fi
    688681WelcomeMessage
    689682# SpaceTests; # Mandrake Linux 8.1 doesn't like this
  • branches/2.05/mondo/ChangeLog

    r195 r196  
    2323- disable x11 build by default (Bruno Cornec)
    2424- remove sbminst (Bruno Cornec/Andree Leidenfrost)
     25- use parted2fdisk everywhere (Bruno Cornec)
    2526
    2627v2.05 (2005-11-19)
  • branches/2.05/mondo/mondo/common/libmondo-devices.c

    r161 r196  
    27482748
    27492749    sprintf(list_drives_cmd,
    2750             // "parted2fdisk
    2751             "fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s",
     2750            "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s",
    27522751            where_is_root_mounted());
    27532752    log_it("list_drives_cmd = %s", list_drives_cmd);
     
    29042903    malloc_string(fdisk);
    29052904    log_msg(0, "Looking for partition table format type");
    2906 // BERLIOS: Do that temporarily: we need to put back parted2fdisk everywhere
    2907 #ifdef __IA64__
    2908     sprintf(fdisk, "/usr/local/bin/fdisk");
    2909     if (stat(fdisk, &buf) != 0) {
    2910 #endif
    2911         sprintf(fdisk, "/sbin/fdisk");
    2912 #ifdef __IA64__
    2913     }
    2914 #endif
     2905    sprintf(fdisk, "/sbin/parted2fdisk");
    29152906    log_msg(1, "Using %s", fdisk);
    29162907    sprintf(command, "%s -l %s | grep 'EFI GPT'", fdisk, drive);
  • branches/2.05/mondo/mondo/common/libmondo-files.c

    r192 r196  
    11891189    char nfs_client_ipaddr[MAX_STR_LEN];
    11901190    char nfs_client_netmask[MAX_STR_LEN];
     1191    char nfs_client_broadcast[MAX_STR_LEN];
    11911192    char nfs_client_defgw[MAX_STR_LEN];
    11921193    char nfs_server_ipaddr[MAX_STR_LEN];
     
    12221223           call_program_and_get_last_line_of_output(command));
    12231224    sprintf(command,
     1225            "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f8 | cut -d':' -f2");
     1226    strcpy(nfs_client_broadcast,
     1227           call_program_and_get_last_line_of_output(command));
     1228    sprintf(command,
    12241229            "route -n | grep '^0.0.0.0' | awk '{printf $2}'");
    12251230    strcpy(nfs_client_defgw,
     
    12391244    }
    12401245    fprintf(fout, "ifconfig lo 127.0.0.1  # config loopback\n");
    1241     fprintf(fout, "ifconfig %s %s netmask %s    # config client\n", nfs_dev,
    1242             nfs_client_ipaddr, nfs_client_netmask);
     1246    fprintf(fout, "ifconfig %s %s netmask %s broadcast %s   # config client\n", nfs_dev,
     1247            nfs_client_ipaddr, nfs_client_netmask, nfs_client_broadcast);
    12431248    fprintf(fout, "route add default gw %s  # default route\n", nfs_client_defgw);
    12441249    fprintf(fout, "ping -c 1 %s # ping server\n", nfs_server_ipaddr);
     
    12621267    sprintf(tmp, "%s/NFS-CLIENT-NETMASK", bkpinfo->tmpdir);
    12631268    write_one_liner_data_file(tmp, nfs_client_netmask);
     1269    sprintf(tmp, "%s/NFS-CLIENT-BROADCAST", bkpinfo->tmpdir);
     1270    write_one_liner_data_file(tmp, nfs_client_broadcast);
    12641271    sprintf(tmp, "%s/NFS-CLIENT-DEFGW", bkpinfo->tmpdir);
    12651272    write_one_liner_data_file(tmp, nfs_client_defgw);
  • branches/2.05/mondo/mondo/common/libmondo-tools.c

    r182 r196  
    12201220    }
    12211221
    1222     if (!run_program_and_log_output("fdisk -l | grep -i raid", 1)
     1222    if (!run_program_and_log_output("parted2fdisk -l | grep -i raid", 1)
    12231223        && !does_file_exist("/etc/raidtab")) {
    12241224        log_to_screen
  • branches/2.05/mondo/mondo/mondorestore/mondo-prep.c

    r128 r196  
    15251525#else
    15261526    make_hole_for_file(FDISK_LOG);
    1527 #ifdef __IA64__
    1528     sprintf(tmp, "parted2fdisk %s >> %s 2>> %s", drivename, FDISK_LOG,
    1529             FDISK_LOG);
    1530 #else
    1531     sprintf(tmp, "fdisk %s >> %s 2>> %s", drivename, FDISK_LOG, FDISK_LOG);
    1532 #endif
     1527    sprintf(tmp, "parted2fdisk %s >> %s 2>> %s", drivename, FDISK_LOG, FDISK_LOG);
    15331528    pout_to_fdisk = popen(tmp, "w");
    15341529    if (!pout_to_fdisk) {
    1535         log_to_screen("Cannot call fdisk to configure %s", drivename);
     1530        log_to_screen("Cannot call parted2fdisk to configure %s", drivename);
    15361531        paranoid_free(device_str);
    15371532        paranoid_free(format);
  • branches/2.05/mondo/mondo/restore-scripts/mondo/grub-MR

    r139 r196  
    166166    line=`cat /proc/mdstat | grep $base | head -n1`
    167167    echo "mbrpart was $mbrpart"
    168     mbrpart=`fdisk -l | grep /dev/ | head -n1 | tr ':' ' ' \
     168    mbrpart=`parted2fdisk -l | grep /dev/ | head -n1 | tr ':' ' ' \
    169169| cut -d' ' -f2`
    170170    echo "mbrpart is $mbrpart"
  • branches/2.05/mondo/mondo/restore-scripts/mondo/make-me-bootable

    r30 r196  
    3131            boot_drv=$drive
    3232            boot_part=$partno
    33 #       if [ "$mountpt" = "/" ] || [ "$mountpt" = "/boot" ] || [ "$format" = "vfat" ] ; then
    34 #           LogIt "Making $i bootable (drive=$drive, partno=$partno)"
    35 #           echo -e -n "a\n$partno\nw\n" | fdisk $drive >> $LOGFILE 2>> $LOGFILE
    36 #            HAVE_ACTIVE="true"
    3733        fi
    3834    fi
Note: See TracChangeset for help on using the changeset viewer.