luci-mod-system: flash.js: fix "rootfs_data" partition detection
The `/sys/devices/virtual/mtd/` information is not available on all devices so rely on the contents of `/proc/mtd` instead to check for the existence of the `rootfs_data` partition. Fixes: #3136 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
fb740f2c79
commit
020ac1e08d
2 changed files with 2 additions and 6 deletions
|
@ -34,7 +34,6 @@
|
||||||
"/proc/mtd": [ "read" ],
|
"/proc/mtd": [ "read" ],
|
||||||
"/proc/partitions": [ "read" ],
|
"/proc/partitions": [ "read" ],
|
||||||
"/proc/sys/kernel/hostname": [ "read" ],
|
"/proc/sys/kernel/hostname": [ "read" ],
|
||||||
"/sys/devices/virtual/mtd/*/name": [ "read" ],
|
|
||||||
"/sys/devices/virtual/ubi/*/name": [ "read" ]
|
"/sys/devices/virtual/ubi/*/name": [ "read" ]
|
||||||
},
|
},
|
||||||
"ubus": {
|
"ubus": {
|
||||||
|
|
|
@ -215,7 +215,7 @@ var mapdata = { actions: {}, config: {} };
|
||||||
|
|
||||||
return L.view.extend({
|
return L.view.extend({
|
||||||
load: function() {
|
load: function() {
|
||||||
var max_mtd = 10, max_ubi = 2, max_ubi_vol = 4;
|
var max_ubi = 2, max_ubi_vol = 4;
|
||||||
var tasks = [
|
var tasks = [
|
||||||
callFileStat('/lib/upgrade/platform.sh'),
|
callFileStat('/lib/upgrade/platform.sh'),
|
||||||
callFileRead('/proc/sys/kernel/hostname'),
|
callFileRead('/proc/sys/kernel/hostname'),
|
||||||
|
@ -223,9 +223,6 @@ return L.view.extend({
|
||||||
callFileRead('/proc/partitions')
|
callFileRead('/proc/partitions')
|
||||||
];
|
];
|
||||||
|
|
||||||
for (var i = 0; i < max_mtd; i++)
|
|
||||||
tasks.push(callFileRead('/sys/devices/virtual/mtd/mtd%d/name'.format(i)));
|
|
||||||
|
|
||||||
for (var i = 0; i < max_ubi; i++)
|
for (var i = 0; i < max_ubi; i++)
|
||||||
for (var j = 0; j < max_ubi_vol; j++)
|
for (var j = 0; j < max_ubi_vol; j++)
|
||||||
tasks.push(callFileRead('/sys/devices/virtual/ubi/ubi%d/ubi%d_%d/name'.format(i, i, j)));
|
tasks.push(callFileRead('/sys/devices/virtual/ubi/ubi%d/ubi%d_%d/name'.format(i, i, j)));
|
||||||
|
@ -497,7 +494,7 @@ return L.view.extend({
|
||||||
hostname = rpc_replies[1],
|
hostname = rpc_replies[1],
|
||||||
procmtd = rpc_replies[2],
|
procmtd = rpc_replies[2],
|
||||||
procpart = rpc_replies[3],
|
procpart = rpc_replies[3],
|
||||||
has_rootfs_data = rpc_replies.slice(4).filter(function(n) { return n == 'rootfs_data' })[0],
|
has_rootfs_data = (procmtd.match(/"rootfs_data"/) != null) || rpc_replies.slice(4).filter(function(n) { return n == 'rootfs_data' })[0],
|
||||||
storage_size = findStorageSize(procmtd, procpart),
|
storage_size = findStorageSize(procmtd, procpart),
|
||||||
m, s, o, ss;
|
m, s, o, ss;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue