Hi,
On Mon, 16 Oct 2006 at 23:13 +0000, Thorsten Glaser wrote:
> Waldemar Brodkorb dixit:
> 
> >It is needed for Netgear, which has one more partition, so that
> >mtdblock5 is not the data partition.
> 
> +       datanr=$(awk -F : '/data/ { print $1 }' /proc/mtd |sed "s#mtd##")
> 
> Why not like fwcf?
> 
> part=/dev/mtd/$(fgrep '"fwcf"' /proc/mtd 2>&- | sed 
> 's/^mtd\([^:]*\):.*$/\1/')ro
> 
> This would effectively mean
> 
> +     datanr=$(fgrep '"data"' /proc/mtd 2>&- | sed 's/^mtd\([^:]*\):.*$/\1/')
> 
> if I got the line above correctly, _and_ is more easy to unserstand.

More easy? Hmm, this seems to be your personal opinion :}
Your regex is far more complex than mine. My patch seems to solve
the Netgear problems, so I will commit it this way.
 
> Alternatively, to save fork() and exec() time, you could do something like
> 
> +     while read line; do
> +             [[ $line = *\"data\"* ]] || continue
> +             line=${line#mtd}
> +             datanr=${line%%:*}
> +     done </proc/mtd

I don't think bootup time will significant be improved in using
shell only.
 
> but I don't know if ash groks this (mksh does). In all THREE cases,
> error handling if /proc isn't mounted, /proc/mtd can't be read, and
> there is no "data" partition, could be added.
> 
> Please test the lines above to see if the result is correct.

Anyway. Thx for your input.

bye
        Waldemar

-- 
don't open your wrt, free it
http://www.freewrt.org
_______________________________________________
freewrt-developers mailing list
[email protected]
https://www.freewrt.org/lists/listinfo/freewrt-developers

Reply via email to