Radix cross Linux

Radix Linux distribution for embedded systems.

637 Commits   4 Branches   3 Tags
author: Andrey V.Kosteltsev <kx@radix.pro> 2016-07-19 10:35:54 +0000 committer: Andrey V.Kosteltsev <kx@radix.pro> 2016-07-19 10:35:54 +0000 commit: 420d9f5856991c509aafce4467ae3d687bf002b4 parent: 899a30cb29a5f23dc0725f57286d77c5660a106b
Commit Summary:
radix-setup: skip active partition field from fdisk output
Diffstat:
1 file changed, 19 insertions, 2 deletions
diff --git a/base/install-tools/sbin/radix-setup.in b/base/install-tools/sbin/radix-setup.in
index e571af7df..7a24a704c 100644
--- a/base/install-tools/sbin/radix-setup.in
+++ b/base/install-tools/sbin/radix-setup.in
@@ -930,7 +930,14 @@ gen_parts_list() {
     # recomended values
     #
     used=
-    partid=`fdisk -l /dev/$devname | grep "^/dev/${prname}" | sed 's,\s\+, ,g' | cut -f 5 -d ' '`
+    # skip active partition sign [asterisk '*']
+    pline=`fdisk -l /dev/$devname | grep "^/dev/${prname}" | sed 's,\s\+, ,g'`
+    active=`echo "$pline" | cut -f 2 -d ' '`
+    if [ "$active" == "*" ] ; then
+      partid=`echo "$pline" | cut -f 6 -d ' '`
+    else
+      partid=`echo "$pline" | cut -f 5 -d ' '`
+    fi
     partid=`printf '%02s' "$partid"`
     if [ "$partid" == "82" -o "$partid" == "82" ] ; then
       mpoint="swap"
@@ -984,9 +991,19 @@ gen_parts_menu_items() {
 
     prname=`echo "$line" | cut -f 1 -d ':'`
 
-    prtype=`fdisk -l /dev/$devname | grep "^${prname}" | sed 's,\s\+, ,g' | cut -f 5 -d ' '`
+    #
+    # get partition type (skipping active partition sign [asterisk '*']):
+    #
+    pline=`fdisk -l /dev/$devname | grep "^/dev/${prname}" | sed 's,\s\+, ,g'`
+    active=`echo "$pline" | cut -f 2 -d ' '`
+    if [ "$active" == "*" ] ; then
+      prtype=`echo "$pline" | cut -f 6 -d ' '`
+    else
+      prtype=`echo "$pline" | cut -f 5 -d ' '`
+    fi
     prtype=`printf '%02s' "$prtype"`
 
+
     prsize=`echo "$line" | cut -f 2 -d ':'`
     let "prsize = prsize / 1048576"
     prsize=`printf '%6d' $prsize`