Skip to content

Commit

Permalink
Remove restriction of supporting only 9 partitions from find_partitio…
Browse files Browse the repository at this point in the history
…n_number()

So the assumption is that partition device /dev/mapper/36001438005deb05d0000e00005c400001 is not a real example. And if it was, we don't support that anymore. I guess time will tell...

See discussion #263 for more information.

PS StopIfError does not stop Relax-and-Recover immediately, it may continue and cause another StopIfError before it really bails out. This is confusing because the second error-message may be caused by the first error, but it could be the only error that the user is looking at...
  • Loading branch information
dagwieers committed Jul 5, 2013
1 parent f72bfbe commit e758bba
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions usr/share/rear/lib/layout-functions.sh
Expand Up @@ -300,7 +300,6 @@ find_partition() {
# This function should support:
# /dev/mapper/36001438005deb05d0000e00005c40000p1
# /dev/mapper/36001438005deb05d0000e00005c40000_part1
# /dev/mapper/36001438005deb05d0000e00005c400001
# /dev/sda1
# /dev/cciss/c0d0p1
#
Expand All @@ -310,13 +309,13 @@ get_partition_number() {
local partition=$1
local number=$(echo "$partition" | grep -o -E "[0-9]+$")

# FIXME: This only supports up to 9 partitions
if (( ${#number} > 1 )); then
number=${number: -1}
fi
# Test if $number is a positive integer, if not it is a bug
[ $number -gt 0 ] 2>&8
StopIfError "Partition number '$number' of partition $partition is not a valid number."

[ $number -gt 0 2>/dev/null ]
BugIfError "Partition number '$number' of partition $partition is not a valid number."
# Catch if $number is too big, report it as a bug
(( $number <= 128 ))
StopIfError "Partition $partition is numbered '$number'. More than 128 partitions is not supported."

echo $number
}
Expand Down

0 comments on commit e758bba

Please sign in to comment.