Changeset 1297 in MondoRescue for branches/stable/mondo/src/restore-scripts
- Timestamp:
- Apr 12, 2007, 1:56:35 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/restore-scripts/mondo/label-partitions-as-necessary
r901 r1297 7 7 8 8 read_partition_line() { 9 local tmp label mountpt mountline command format 10 if [ "`echo "$1" | grep "LABEL="`" != "" ] ; then 9 local tmp label mountpt command format 10 11 if [ "`echo "$1" | grep -E 'LABEL='`" != "" ] ; then 12 opttun="-L" 13 elif [ "`echo "$1" | grep -E 'UUID='`" != "" ] ; then 14 opttun="-U" 15 else 16 # Nothing to do 17 return 18 fi 19 11 20 tmp=`echo "$1" | tr -s ' ' '\t' | cut -f1` 12 21 label=`echo "$tmp" | cut -d'=' -f2` 13 22 format=`echo "$1" | tr -s ' ' '\t' | cut -f3` 14 mountline=`mount | grep " $label "` 15 # mountpt=`echo "$mountline" | cut -d' ' -f1` 16 ! mountpt=`grep " $label " $mountlist | cut -d' ' -f1` 17 if [ ! "$mountpt" ] ; then 18 LogIt "Not labeling anything as $label because $mountpt is not a mountpoint" 19 elif [ ! "$label" ] ; then 20 LogIt "Not labeling $mountpt as anything because $label is not a label" 21 else 22 if [ "$format" = "ext2" ] || [ "$format" = "ext3" ] ; then 23 command="e2label $mountpt $label" 24 LogIt "Running $command" 25 $command 26 elif [ "$format" = "swap" ] ; then 27 command="mkswap -L $label $mountpt" 28 LogIt "Running $command" 29 else 30 LogIt "I am NOT going to run e2label: the partition is format '$format', which doesn't like e2label anyway" 31 fi 23 mountpt=`grep -w " $label" $mountlist | cut -d' ' -f1` 24 if [ ! "$mountpt" ] ; then 25 LogIt "Not labeling anything as $label because $mountpt is not a mountpoint" 26 elif [ ! "$label" ] ; then 27 LogIt "Not labeling $mountpt as anything because $label is not a label" 28 else 29 if [ "$format" = "ext2" ] || [ "$format" = "ext3" ] ; then 30 command="tune2fs $opttun $label $mountpt" 31 LogIt "Running $command" 32 $command 33 elif [ "$format" = "swap" ] ; then 34 if [ "$opttun" = "-U" ]; then 35 echo "Unable yet to identify swap with UUID" 36 else 37 command="mkswap $opttun $label $mountpt" 38 LogIt "Running $command" 39 $command 40 fi 41 else 42 LogIt "I am NOT going to run tune2fs: the partition is format '$format', which doesn't like tune2fs anyway" 43 fi 32 44 fi 33 fi34 45 } 35 36 46 37 47 38 48 # --------------------------------------------- 39 49 40 LogIt " Labeling your drives with e2label"50 LogIt "Identifying your drives with tune2fs" 41 51 if [ "$#" -ne "1" ] ; then 42 52 LogIt "label-partitions-as-necessary /tmp/mountlist.txt < /tmp/fstab.new" 1
Note:
See TracChangeset
for help on using the changeset viewer.