luci-mod-system: flash.js: improve storage size detection heuristics
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
66749b4fe3
commit
3c40a7450a
1 changed files with 6 additions and 4 deletions
|
@ -161,24 +161,26 @@ function findStorageSize(procmtd, procpart) {
|
||||||
var kernsize = 0, rootsize = 0, wholesize = 0;
|
var kernsize = 0, rootsize = 0, wholesize = 0;
|
||||||
|
|
||||||
procmtd.split(/\n/).forEach(function(ln) {
|
procmtd.split(/\n/).forEach(function(ln) {
|
||||||
var match = ln.match(/^mtd\d+: ([0-9a-f]+) [0-9a-f]+ "(.+)"$/);
|
var match = ln.match(/^mtd\d+: ([0-9a-f]+) [0-9a-f]+ "(.+)"$/),
|
||||||
|
size = match ? parseInt(match[1], 16) : 0;
|
||||||
|
|
||||||
switch (match ? match[2] : '') {
|
switch (match ? match[2] : '') {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
case 'firmware':
|
case 'firmware':
|
||||||
wholesize = parseInt(match[1], 16);
|
if (size > wholesize)
|
||||||
|
wholesize = size;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'kernel':
|
case 'kernel':
|
||||||
case 'kernel0':
|
case 'kernel0':
|
||||||
kernsize = parseInt(match[1], 16);
|
kernsize = size;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'rootfs':
|
case 'rootfs':
|
||||||
case 'rootfs0':
|
case 'rootfs0':
|
||||||
case 'ubi':
|
case 'ubi':
|
||||||
case 'ubi0':
|
case 'ubi0':
|
||||||
rootsize = parseInt(match[1], 16);
|
rootsize = size;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue