Changeset 690 in MondoRescue


Ignore:
Timestamp:
Jul 21, 2006, 2:49:52 AM (18 years ago)
Author:
bcornec
Message:
  • Better error message when LABEL is found for non mounted partition (USB dev e.g.) (report from David Giddy <d.giddy_at_bigpond.com>)
  • Fix a bug with redhat_label not initialized in the loop systematically ( report from Anthony P. Machon" <amachon_at_camiant.com>)
Location:
branches/stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mindi/mindi

    r682 r690  
    13371337    [ "$IMAGE_DEVS" != "" ] && all_partitions="`echo "$all_partitions $IMAGE_DEVS" | tr ' ' '\n' | sort -u | tr '\n ' ' '`"
    13381338    printf "        %-15s %-15s %-15s %-15s\n" DEVICE MOUNTPOINT FORMAT "SIZE (MB)"
     1339    useless_dev="/dev/floppy /dev/fd0h1440 /dev/fd0H1440 /dev/cdrom /dev/cdrom/cdrom /dev/cdrom/cdrom1 /dev/cdrom/cdrom2 /dev/cdrom0 /dev/cdrom1 /dev/cdrom2 /dev/cdrom3 /dev/cdrw /dev/scd /dev/ram :/ /dev/sr0 /dev/sr1 /dev/cdrom1"
    13391340    for c_p in $all_partitions ; do
    13401341#        echo "c_p = $c_p" > /dev/stderr
    1341         [ "`echo "/dev/floppy /dev/fd0h1440 /dev/fd0H1440 /dev/cdrom /dev/cdrom/cdrom /dev/cdrom/cdrom1 /dev/cdrom/cdrom2 /dev/cdrom0 /dev/cdrom1 /dev/cdrom2 /dev/cdrom3 /dev/cdrw" | grep -F "$c_p"`" != "" ] || [ "`echo "$c_p" | grep -F "/dev/scd"`" != "" ] || [ "`echo "$c_p" | grep -F "/dev/ram"`" != "" ] || [ "`echo "$c_p" | grep ":"`" != "" ] || [ "`echo "$c_p" | grep -F ":/"`" != "" ] && continue
    1342         [ "`echo "/dev/scd0 /dev/scd1 /dev/sr0 /dev/sr1 /dev/cdrom /dev/cdrom1" | grep -F "$c_p"`" ] && continue
     1342        [ "`echo "$useless_dev" | grep -F "$c_p"`" != "" ] || [ "`echo "$c_p" | grep ":"`" != "" ] && continue
    13431343        [ "`echo "$c_p" | grep -x "/dev/cdroms.*"`" ] && continue
    13441344        if [ -h "$c_p" ] && [ "`echo "$c_p" | grep -F "/dev/hd"`" = "" ] && [ "`echo "$c_p" | grep -F "/dev/sd"`" = "" ] && [ "`echo "$c_p" | grep -F "/dev/md"`" = "" ] ; then
    13451345            current_partition=`ResolveSoftlink $c_p`
    13461346            [ "`echo "$current_partition" | grep -F "/dev/mapper"`" != "" ] && current_partition="$c_p"
    1347             [ "`echo "/dev/scd0 /dev/scd1 /dev/sr0 /dev/sr1 /dev/cdrom /dev/cdrom1" | grep -F "$current_partition"`" ] && continue
     1347            [ "`echo "$useless_dev" | grep -F "$current_partition"`" ] && continue
    13481348        else
    13491349            current_partition="$c_p"
    13501350        fi
    13511351        [ "$c_p" = "none" ] && continue
     1352        redhat_label=""
    13521353        absolute_partition=`ResolveSoftlink $c_p`
    13531354        partition_mountpt=`tr -s '\t' ' ' < $MY_FSTAB | /bin/grep -w "$current_partition" | /bin/grep -vx " *#.*" | $AWK '{print $2}' | head -n1`
     
    13601361            actual_dev=""
    13611362   
    1362         # 1st try : blkid, the good way
    1363         if [ -x "/sbin/blkid" ]; then
    1364             actual_dev=`/sbin/blkid | /bin/grep "$current_partition" | /bin/cut -d':' -f1`
    1365         fi
    1366 
    1367         # 2nd try, which works on a standard partition (ext2/3), but not on swap
    1368         if [ "x$actual_dev" = "x" ]; then
    1369             actual_dev=`/bin/mount -l | /bin/grep "\[$redhat_label\]" | /bin/cut -d' ' -f1`
    1370         fi
    1371 
    1372         # 3rd try, with vol_id (which works with swap)
    1373         if [ "x$actual_dev" = "x" -a -x "/sbin/vol_id" ]; then
     1363            # 1st try : blkid, the good way
     1364            if [ -x "/sbin/blkid" ]; then
     1365                actual_dev=`/sbin/blkid | /bin/grep "$current_partition" | /bin/cut -d':' -f1`
     1366            fi
     1367   
     1368            # 2nd try, which works on a standard partition (ext2/3), but not on swap
     1369            if [ "x$actual_dev" = "x" ]; then
     1370                actual_dev=`/bin/mount -l | /bin/grep "\[$redhat_label\]" | /bin/cut -d' ' -f1`
     1371            fi
     1372   
     1373            # 3rd try, with vol_id (which works with swap)
     1374            if [ "x$actual_dev" = "x" -a -x "/sbin/vol_id" ]; then
    13741375                list_swaps=`cat /proc/swaps | /bin/grep "/dev/" | /bin/awk '{ print $1 }' `
    13751376                for dev_swap in $list_swaps ; do
     
    13801381                    fi
    13811382                done
    1382         fi
    1383 
    1384         # 4th try : pre-formated LABEL. Format is : LABEL=SWAP-mydevice. e.g. : LABEL=SWAP-hda5
    1385         if [ "x$actual_dev" = "x" -a  _"`echo $current_partition | /bin/grep -i 'LABEL=SWAP'`" != _"" ]; then
     1383            fi
     1384
     1385            # 4th try : pre-formated LABEL. Format is : LABEL=SWAP-mydevice. e.g. : LABEL=SWAP-hda5
     1386            if [ "x$actual_dev" = "x" -a  _"`echo $current_partition | /bin/grep -i 'LABEL=SWAP'`" != _"" ]; then
    13861387                try_dev="`echo "$redhat_label" | /bin/cut -d '-' -f2`"
    13871388                present_dev="`/bin/cat /proc/swaps | /bin/grep -w /dev/$try_dev`"
     
    13891390                    actual_dev="/dev/$try_dev"
    13901391                fi
    1391         fi
    1392 
    1393         # Check if one of all those tries has known success
    1394         if [ "x$actual_dev" != "x" ]; then
     1392            fi
     1393
     1394            # Check if one of all those tries has known success
     1395            if [ "x$actual_dev" != "x" ]; then
    13951396                current_partition=$actual_dev
     1397            else
     1398                Die "Your system uses a labelled swap partition, but you lack the tool to support it.\nPlease replace swap labels with their correct devices in /etc/fstab or install blkid|vol_id\n"
     1399            fi
    13961400        else
    1397             Die "Your system uses a labelled swap partition, but you lack the tool to support it.\nPlease replace swap labels with their correct devices in /etc/fstab\n"
    1398         fi
    1399     else
    1400         str_to_find_fmt_with=$current_partition
    1401     fi
     1401            str_to_find_fmt_with=$current_partition
     1402        fi
    14021403
    14031404    partition_format=`$AWK '$1 == "'"$str_to_find_fmt_with"'" {print $3}' $MY_FSTAB`
  • branches/stable/tools/build2pkg

    r659 r690  
    8585            cat $log
    8686            status=-1
     87        else
     88            egrep '^Wrote:' $log
     89            rpmlint `egrep '^Wrote:' $log | cut -d: -f2`
    8790        fi
    88         egrep '^Wrote:' $log
    8991        rm -rf ${TOPBUILDDIR}/BUILD/*
    9092        cd ..
Note: See TracChangeset for help on using the changeset viewer.