summaryrefslogtreecommitdiff
path: root/src/core/libs/lib-blockdevices-filesystems.sh
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2011-02-08 22:25:03 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2011-02-08 22:25:03 +0100
commitba840a69a5618e0c6b5f21d4a3e9c3239abf2763 (patch)
tree57df3e80e65eb5c5c7840b17b5859fea1342a950 /src/core/libs/lib-blockdevices-filesystems.sh
parentadfa636f228aea89341ddcfd7cd9c927d8dd2242 (diff)
simplify mapdev() API a bit, fix indentation
Diffstat (limited to 'src/core/libs/lib-blockdevices-filesystems.sh')
-rw-r--r--src/core/libs/lib-blockdevices-filesystems.sh68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh
index 03f6a95..c232ac4 100644
--- a/src/core/libs/lib-blockdevices-filesystems.sh
+++ b/src/core/libs/lib-blockdevices-filesystems.sh
@@ -315,40 +315,40 @@ EOF
# TODO: $1 is what?? ASKDEV
# taken from setup. slightly edited.
mapdev() {
- partition_flag=0
- device_found=0
- devs=$( grep -v fd $TMP_DEV_MAP | sed 's/ *\t/ /' | sed ':a;$!N;$!ba;s/\n/ /g')
- linuxdevice=$(echo $1 | cut -b1-8)
- if [ "$(echo $1 | egrep '[0-9]$')" ]; then
- # /dev/hdXY
- pnum=$(echo $1 | cut -b9-)
- pnum=$(($pnum-1))
- partition_flag=1
- fi
- for dev in $devs
- do
- if [ "(" = $(echo $dev | cut -b1) ]; then
- grubdevice="$dev"
- else
- if [ "$dev" = "$linuxdevice" ]; then
- device_found=1
- break
- fi
- fi
- done
- if [ "$device_found" = "1" ]; then
- if [ "$partition_flag" = "0" ]; then
- echo "$grubdevice"
- else
- grubdevice_stringlen=${#grubdevice}
- grubdevice_stringlen=$(($grubdevice_stringlen - 1))
- grubdevice=$(echo $grubdevice | cut -b1-$grubdevice_stringlen)
- echo "$grubdevice,$pnum)"
- fi
- else
- echo "DEVICE NOT FOUND" >&2
- return 2
- fi
+ partition_flag=0
+ device_found=0
+ devs=$( grep -v fd $TMP_DEV_MAP | sed 's/ *\t/ /' | sed ':a;$!N;$!ba;s/\n/ /g')
+ linuxdevice=$(echo $1 | cut -b1-8)
+ if [ "$(echo $1 | egrep '[0-9]$')" ]; then
+ # /dev/hdXY
+ pnum=$(echo $1 | cut -b9-)
+ pnum=$(($pnum-1))
+ partition_flag=1
+ fi
+ for dev in $devs
+ do
+ if [ "(" = $(echo $dev | cut -b1) ]; then
+ grubdevice="$dev"
+ else
+ if [ "$dev" = "$linuxdevice" ]; then
+ device_found=1
+ break
+ fi
+ fi
+ done
+ if [ "$device_found" = "1" ]; then
+ if [ "$partition_flag" = "0" ]; then
+ echo "$grubdevice"
+ else
+ grubdevice_stringlen=${#grubdevice}
+ grubdevice_stringlen=$(($grubdevice_stringlen - 1))
+ grubdevice=$(echo $grubdevice | cut -b1-$grubdevice_stringlen)
+ echo "$grubdevice,$pnum)"
+ fi
+ return 0
+ else
+ return 1
+ fi
}