From a928465fdab1ccdce56be1ebbf9f638126ebd265 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 9 May 2009 18:23:02 +0000 Subject: [PATCH] luci-0.8: merge r4500 and r4501 --- modules/admin-full/luasrc/controller/admin/system.lua | 8 ++++++++ modules/admin-mini/luasrc/controller/mini/system.lua | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/modules/admin-full/luasrc/controller/admin/system.lua b/modules/admin-full/luasrc/controller/admin/system.lua index 33e46b74b..ff000ab75 100644 --- a/modules/admin-full/luasrc/controller/admin/system.lua +++ b/modules/admin-full/luasrc/controller/admin/system.lua @@ -214,6 +214,14 @@ function action_upgrade() break end end + elseif luci.fs.access("/proc/partitions") then + for l in io.lines("/proc/partitions") do + local x, y, b, n = l:match('^%s*(%d+)%s+(%d+)%s+([^%s]+)%s+([^%s]+)') + if b and n and not n:match('[0-9]') then + size = tonumber(b) * 1024 + break + end + end end return size end diff --git a/modules/admin-mini/luasrc/controller/mini/system.lua b/modules/admin-mini/luasrc/controller/mini/system.lua index ad15b076b..bb93a34c4 100644 --- a/modules/admin-mini/luasrc/controller/mini/system.lua +++ b/modules/admin-mini/luasrc/controller/mini/system.lua @@ -106,6 +106,14 @@ function action_upgrade() break end end + elseif luci.fs.access("/proc/partitions") then + for l in io.lines("/proc/partitions") do + local x, y, b, n = l:match('^%s*(%d+)%s+(%d+)%s+([^%s]+)%s+([^%s]+)') + if b and n and not n:match('[0-9]') then + size = tonumber(b) * 1024 + break + end + end end return size end -- 2.25.1