diff mbox

[01/10] Fix lopartsetup parsing of fdisk output

Message ID 1489845611-6322-2-git-send-email-geza.gemes@gmail.com
State New, archived
Headers show

Commit Message

Gémes Géza March 18, 2017, 2 p.m. UTC
Change lopartsetup in order to handle partitions, which have the
boot flag enabled.

Signed-off-by: Géza Gémes <geza.gemes@gmail.com>
---
 scripts/lopartsetup | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/scripts/lopartsetup b/scripts/lopartsetup
index bf33a28..04ce3cc 100755
--- a/scripts/lopartsetup
+++ b/scripts/lopartsetup
@@ -58,7 +58,11 @@  index=0
 for i in "`fdisk -lu $filename 2>/dev/null | grep -e "^$filename"`"
 do
     index=$((index+1))
-    offset=`echo $i | tr -s " " | cut -d " " -f 2`
+    offset=`echo "$i" | tr -s " " | cut -d " " -f 2`
+    if [[ "$offset" == "*" ]]
+    then
+        offset=`echo "$i" | tr -s " " | cut -d " " -f 3`
+    fi
     offset=$((unit*offset))
 
     _create_loop_device "$filename" "$index" "$offset"