Browse Source

improved detection of the cfgfs partition by checking for the ID of the partition

Signed-off-by: Joerg Seitter <adk@seitter.net>
Joerg Seitter 3 years ago
parent
commit
b19a2db16f
1 changed files with 3 additions and 2 deletions
  1. 3 2
      package/cfgfs/src/fwcf.sh

+ 3 - 2
package/cfgfs/src/fwcf.sh

@@ -132,12 +132,13 @@ echo $rootdisk|grep mmcblk >/dev/null 2>&1
 if [ $? -ne 0 ]; then
   rootdisk=${rootdisk%[1-9]}
 fi
-part=$(fdisk -l $rootdisk 2>/dev/null|grep '^/dev'|tail -1|awk '{ print $1 }')
+# find last partition with an 88 id
+part=$(fdisk -l $rootdisk 2>/dev/null|awk '{if ($2=="*")  { print $1" "$9} else {print $1" "$8}}'|grep '^/dev.*88.*'|tail -1|awk '{ print $1 }')
 if [ -f .cfgfs ]; then
   . /.cfgfs
 fi
 if [ -z $part ]; then
-	part=$(fdisk -l /dev/sda 2>/dev/null|grep '^/dev'|tail -1|awk '{ print $1 }')
+	part=$(fdisk -l /dev/sda 2>/dev/null|awk '{if ($2=="*")  { print $1" "$9} else {print $1" "$8}}'|grep '^/dev.*88.*'|tail -1|awk '{ print $1 }')
 	if [ -z $part ]; then
 		# otherwise search for MTD device with name cfgfs
 		part=/dev/mtd$(fgrep '"cfgfs"' /proc/mtd 2>/dev/null | sed 's/^mtd\([^:]*\):.*$/\1/')ro