summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-full/luasrc/model/cbi
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-04-17 12:34:54 +0200
committerJo-Philipp Wich <jow@openwrt.org>2015-04-17 12:39:11 +0200
commitec09e995a843a57ae9e66b63dc64634e94d0b4f1 (patch)
tree545ede537693d73dd0e51ae337289d49f12b5ef3 /modules/luci-mod-admin-full/luasrc/model/cbi
parent622cfc673ab2e97001ed394f8cd6d0425d8f3378 (diff)
luci-mod-admin-full: handle missing size for block devices
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'modules/luci-mod-admin-full/luasrc/model/cbi')
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/fstab.lua12
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/fstab/mount.lua14
2 files changed, 20 insertions, 6 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/fstab.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/fstab.lua
index 4c806dbc43..fd6175835b 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/fstab.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/fstab.lua
@@ -87,24 +87,30 @@ dev.cfgvalue = function(self, section)
v = m.uci:get("fstab", section, "uuid")
e = v and devices[v:lower()]
- if v and e then
+ if v and e and e.size then
return "UUID: %s (%s, %d MB)" %{ tp.pcdata(v), e.dev, e.size }
+ elseif v and e then
+ return "UUID: %s (%s)" %{ tp.pcdata(v), e.dev }
elseif v then
return "UUID: %s (<em>%s</em>)" %{ tp.pcdata(v), translate("not present") }
end
v = m.uci:get("fstab", section, "label")
e = v and devices[v]
- if v and e then
+ if v and e and e.size then
return "Label: %s (%s, %d MB)" %{ tp.pcdata(v), e.dev, e.size }
+ elseif v and e then
+ return "Label: %s (%s)" %{ tp.pcdata(v), e.dev }
elseif v then
return "Label: %s (<em>%s</em>)" %{ tp.pcdata(v), translate("not present") }
end
v = Value.cfgvalue(self, section) or "?"
e = v and devices[v]
- if v and e then
+ if v and e and e.size then
return "%s (%d MB)" %{ tp.pcdata(v), e.size }
+ elseif v and e then
+ return tp.pcdata(v)
elseif v then
return "%s (<em>%s</em>)" %{ tp.pcdata(v), translate("not present") }
end
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/fstab/mount.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/fstab/mount.lua
index 54beb63b42..2652e00f25 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/fstab/mount.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/fstab/mount.lua
@@ -57,8 +57,10 @@ o = mount:taboption("general", Value, "uuid", translate("UUID"),
translate("If specified, mount the device by its UUID instead of a fixed device node"))
for i, d in ipairs(devices) do
- if d.uuid then
+ if d.uuid and d.size then
o:value(d.uuid, "%s (%s, %d MB)" %{ d.uuid, d.dev, d.size })
+ elseif d.uuid then
+ o:value(d.uuid, "%s (%s)" %{ d.uuid, d.dev })
end
end
@@ -71,8 +73,10 @@ o = mount:taboption("general", Value, "label", translate("Label"),
o:depends("uuid", "")
for i, d in ipairs(devices) do
- if d.label then
+ if d.label and d.size then
o:value(d.label, "%s (%s, %d MB)" %{ d.label, d.dev, d.size })
+ elseif d.label then
+ o:value(d.label, "%s (%s)" %{ d.label, d.dev })
end
end
@@ -85,7 +89,11 @@ o = mount:taboption("general", Value, "device", translate("Device"),
o:depends({ uuid = "", label = "" })
for i, d in ipairs(devices) do
- o:value(d.dev, "%s (%d MB)" %{ d.dev, d.size })
+ if d.size then
+ o:value(d.dev, "%s (%d MB)" %{ d.dev, d.size })
+ else
+ o:value(d.dev)
+ end
end