[SuperR Kitchen] bigrammy:
Hi Sorry for the late response due to (work :( )

Point taken about sgdisk and your correct of course :good:

I am still not totally convinced about using the fstab from recovery due to all the random possibility's and the script will take the first one it finds that contains by-name which may be incorrect as said earlier.

So given we can not reliabley use sgdisk and the recovery fstab what about using "find" which should be universal and will get the correct path from the device. :fingers-crossed:

I have done a few experiments and this is the result

Modified your code but using find instead

BYNAME=$(for i in $(find /dev -name by-name); do echo $i | grep by-name; done)

Check

root@ZM1:/ # echo $BYNAME

Output

/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name

I am Not sure if this will work for all but it does work for Mediatek :confused:

If other SoC devices have more than one "by-name" existing in /dev then maybe you could check to see if they lead to an actual block number using this with some kind of if else script :eek:

Code:

root@ZM1:/ # find /dev -name by-name -exec ls -n '{}' ';'

Output:

total 0
lrwxrwxrwx 1 0 0 20 2017-01-15 23:21 boot -> /dev/block/mmcblk0p7
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 box -> /dev/block/mmcblk0p18
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 cache -> /dev/block/mmcblk0p29
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 cda -> /dev/block/mmcblk0p22
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 expdb -> /dev/block/mmcblk0p10
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 flashinfo -> /dev/block/mmcblk0p31
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 frp -> /dev/block/mmcblk0p25
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 ftm_boot -> /dev/block/mmcblk0p23
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 ftm_system -> /dev/block/mmcblk0p24
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 hidden -> /dev/block/mmcblk0p21
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 keystore -> /dev/block/mmcblk0p14
lrwxrwxrwx 1 0 0 20 2017-01-15 23:21 lk -> /dev/block/mmcblk0p5
lrwxrwxrwx 1 0 0 20 2017-01-15 23:21 logo -> /dev/block/mmcblk0p9
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 metadata -> /dev/block/mmcblk0p27
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 multlogo -> /dev/block/mmcblk0p17
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 nvdata -> /dev/block/mmcblk0p26
lrwxrwxrwx 1 0 0 20 2017-01-15 23:21 nvram -> /dev/block/mmcblk0p2
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 oemkeystore -> /dev/block/mmcblk0p12
lrwxrwxrwx 1 0 0 20 2017-01-15 23:21 para -> /dev/block/mmcblk0p6
lrwxrwxrwx 1 0 0 20 2017-01-15 23:21 proinfo -> /dev/block/mmcblk0p1
lrwxrwxrwx 1 0 0 20 2017-01-15 23:21 protect1 -> /dev/block/mmcblk0p3
lrwxrwxrwx 1 0 0 20 2017-01-15 23:21 protect2 -> /dev/block/mmcblk0p4
lrwxrwxrwx 1 0 0 20 2017-01-15 23:21 recovery -> /dev/block/mmcblk0p8
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 seccfg -> /dev/block/mmcblk0p11
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 secro -> /dev/block/mmcblk0p13
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 sutinfo -> /dev/block/mmcblk0p20
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 sys_info -> /dev/block/mmcblk0p19
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 system -> /dev/block/mmcblk0p28
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 tee1 -> /dev/block/mmcblk0p15
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 tee2 -> /dev/block/mmcblk0p16
lrwxrwxrwx 1 0 0 21 2017-01-15 23:21 userdata -> /dev/block/mmcblk0p30

:eek:

I still need to read up on the grep cut awk and other stuff which will probably take me a few years :laugh:

Your thoughts welcome as always :o