Changeset 618 in MondoRescue for trunk/mindi/mindi
- Timestamp:
- Jun 3, 2006, 12:16:18 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mindi/mindi
r588 r618 1366 1366 1367 1367 if [ -d "/proc/lvm" ] || [ -d "/dev/mapper" ]; then 1368 echo -en "\rAnalyzing LVM...\r"1369 all_partitions=`$MINDI_LIB/analyze-my-lvm | fgrep ">>>" | cut -d' ' -f2-32`1368 echo -en "\rAnalyzing LVM...\r" 1369 all_partitions=`$MINDI_LIB/analyze-my-lvm | fgrep ">>>" | cut -d' ' -f2-32` 1370 1370 fi 1371 1371 all_partitions="$all_partitions `ListAllPartitions 2> /dev/null`" … … 1378 1378 for c_p in $all_partitions ; do 1379 1379 # echo "c_p = $c_p" > /dev/stderr 1380 [ "`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" | fgrep "$c_p"`" != "" ] || [ "`echo "$c_p" | fgrep "/dev/scd"`" != "" ] || [ "`echo "$c_p" | fgrep "/dev/ram"`" != "" ] || [ "`echo "$c_p" | grep ":"`" != "" ] || [ "`echo "$c_p" | fgrep ":/"`" != "" ] && continue1380 [ "`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" | fgrep "$c_p"`" != "" ] || [ "`echo "$c_p" | fgrep "/dev/scd"`" != "" ] || [ "`echo "$c_p" | fgrep "/dev/ram"`" != "" ] || [ "`echo "$c_p" | grep ":"`" != "" ] || [ "`echo "$c_p" | fgrep ":/"`" != "" ] && continue 1381 1381 [ "`echo "/dev/scd0 /dev/scd1 /dev/sr0 /dev/sr1 /dev/cdrom /dev/cdrom1" | fgrep "$c_p"`" ] && continue 1382 [ "`echo "$c_p" | grep -x "/dev/cdroms.*"`" ] && continue1383 if [ -h "$c_p" ] && [ "`echo "$c_p" | fgrep "/dev/hd"`" = "" ] && [ "`echo "$c_p" | fgrep "/dev/sd"`" = "" ] && [ "`echo "$c_p" | fgrep "/dev/md"`" = "" ] ; then1384 current_partition=`ResolveSoftlink $c_p`1385 [ "`echo "$current_partition" | fgrep "/dev/mapper"`" != "" ] && current_partition="$c_p"1386 [ "`echo "/dev/scd0 /dev/scd1 /dev/sr0 /dev/sr1 /dev/cdrom /dev/cdrom1" | fgrep "$current_partition"`" ] && continue1387 else1388 current_partition="$c_p"1389 fi1390 [ "$c_p" = "none" ] && continue1391 absolute_partition=`ResolveSoftlink $c_p`1392 partition_mountpt=`tr -s '\t' ' ' < $MY_FSTAB | /bin/grep -w "$current_partition" | /bin/grep -vx " *#.*" | $AWK '{print $2}' | head -n1`1393 1394 # This part tries to retrieve the correct device from a LABEL line in /etc/fstab1395 # current_partition contains only first column of /etc/fstab1396 if [ "`echo "$current_partition" | /bin/grep -f -i "LABEL="`" != "" ]; then1397 str_to_find_fmt_with=$current_partition1398 redhat_label=`echo "$current_partition" | /bin/cut -d'=' -f2`1399 actual_dev=""1400 1382 [ "`echo "$c_p" | grep -x "/dev/cdroms.*"`" ] && continue 1383 if [ -h "$c_p" ] && [ "`echo "$c_p" | fgrep "/dev/hd"`" = "" ] && [ "`echo "$c_p" | fgrep "/dev/sd"`" = "" ] && [ "`echo "$c_p" | fgrep "/dev/md"`" = "" ] ; then 1384 current_partition=`ResolveSoftlink $c_p` 1385 [ "`echo "$current_partition" | fgrep "/dev/mapper"`" != "" ] && current_partition="$c_p" 1386 [ "`echo "/dev/scd0 /dev/scd1 /dev/sr0 /dev/sr1 /dev/cdrom /dev/cdrom1" | fgrep "$current_partition"`" ] && continue 1387 else 1388 current_partition="$c_p" 1389 fi 1390 [ "$c_p" = "none" ] && continue 1391 absolute_partition=`ResolveSoftlink $c_p` 1392 partition_mountpt=`tr -s '\t' ' ' < $MY_FSTAB | /bin/grep -w "$current_partition" | /bin/grep -vx " *#.*" | $AWK '{print $2}' | head -n1` 1393 1394 # This part tries to retrieve the correct device from a LABEL line in /etc/fstab 1395 # current_partition contains only first column of /etc/fstab 1396 if [ "`echo "$current_partition" | /bin/grep -i "LABEL="`" != "" ]; then 1397 str_to_find_fmt_with=$current_partition 1398 redhat_label=`echo "$current_partition" | /bin/cut -d'=' -f2` 1399 actual_dev="" 1400 1401 1401 # 1st try : blkid, the good way 1402 if [ -x "/sbin/blkid" ] 1402 if [ -x "/sbin/blkid" ]; then 1403 1403 actual_dev=`/sbin/blkid | /bin/grep "$current_partition" | /bin/cut -d':' -f1` 1404 1404 fi 1405 1405 1406 1406 # 2nd try, which works on a standard partition (ext2/3), but not on swap 1407 if [ "x$actual_dev" = "x" ] 1408 actual_dev=`/bin/mount -l | /bin/grep " [$redhat_label]" | /bin/cut -d' ' -f1`1407 if [ "x$actual_dev" = "x" ]; then 1408 actual_dev=`/bin/mount -l | /bin/grep "\[$redhat_label\]" | /bin/cut -d' ' -f1` 1409 1409 fi 1410 1410 1411 1411 # 3rd try, with vol_id (which works with swap) 1412 if [ "x$actual_dev" = "x" -a -x "/sbin/vol_id" ] 1412 if [ "x$actual_dev" = "x" -a -x "/sbin/vol_id" ]; then 1413 1413 list_swaps=`cat /proc/swaps | /bin/grep "/dev/" | /bin/awk '{ print $1 }' ` 1414 1414 for dev_swap in $list_swaps ; do 1415 1415 dev_exists=`/sbin/vol_id $dev_swap | /bin/grep "$redhat_label"` 1416 if [ "x$dev_exists" != "x" ] 1416 if [ "x$dev_exists" != "x" ]; then 1417 1417 actual_dev=$dev_swap 1418 1418 break; … … 1422 1422 1423 1423 # 4th try : pre-formated LABEL. Format is : LABEL=SWAP-mydevice. e.g. : LABEL=SWAP-hda5 1424 if [ "x$actual_dev" = "x" -a "`echo "$current_partition" | /bin/grep -i "LABEL=SWAP"`" != ""]; then1424 if [ "x$actual_dev" = "x" -a _"`echo $current_partition | /bin/grep -i 'LABEL=SWAP'`" != _"" ]; then 1425 1425 try_dev="`echo "$redhat_label" | /bin/cut -d '-' -f2`" 1426 1426 present_dev="`/bin/cat /proc/swaps | /bin/grep -w /dev/$try_dev`" … … 1431 1431 1432 1432 # Check if one of all those tries has known success 1433 if [ "x$actual_dev" != "x" ] 1433 if [ "x$actual_dev" != "x" ]; then 1434 1434 current_partition=$actual_dev 1435 1435 else … … 1441 1441 1442 1442 partition_format=`$AWK '$1 == "'"$str_to_find_fmt_with"'" {print $3}' $MY_FSTAB` 1443 if [ -d "/proc/lvm" ] && [ "`lvdisplay $current_partition 2> /dev/null`" ] 1443 if [ -d "/proc/lvm" ] && [ "`lvdisplay $current_partition 2> /dev/null`" ]; then 1444 1444 partition_size="lvm" 1445 elif [ -d "/dev/mapper" ] && [ "`lvm lvdisplay $current_partition 2> /dev/null`" ] 1445 elif [ -d "/dev/mapper" ] && [ "`lvm lvdisplay $current_partition 2> /dev/null`" ]; then 1446 1446 partition_size="lvm" 1447 1447 else
Note:
See TracChangeset
for help on using the changeset viewer.