summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2010-09-28 14:26:09 +0000
committerTed Trask <ttrask01@yahoo.com>2010-09-28 14:26:09 +0000
commit90d932e72176466041a298e807d8efe4c1c65c68 (patch)
tree75065073f49aa36b12cfdddf30912231d430e84f
parent87321fa7aa82ac9665ede7c2bc9b896f1f0ef339 (diff)
downloadacf-alpine-baselayout-90d932e72176466041a298e807d8efe4c1c65c68.tar.bz2
acf-alpine-baselayout-90d932e72176466041a298e807d8efe4c1c65c68.tar.xz
Proper fix for health storage to handle one or two-line entries.
-rw-r--r--health-model.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/health-model.lua b/health-model.lua
index 16b4d2a..2749e2a 100644
--- a/health-model.lua
+++ b/health-model.lua
@@ -58,7 +58,15 @@ get_storage = function (self)
local storage = {}
local disk = diskfree() .. "\n"
local other = {}
- for line in string.gmatch(disk, "\n([^\n]*\n[^\n]*)") do
+ local lines = format.string_to_table(disk, "\n")
+ local i = 1 -- skip the first line
+ while i < #lines do
+ i = i+1
+ line = lines[i] or ""
+ if lines[i+1] and string.match(lines[i+1], "^%s") then
+ i = i+1
+ line = line .. "\n" .. lines[i]
+ end
if string.match(line, "^/dev/fd%d+") then
if not storage.floppy then
storage.floppy = cfe({ type="group", value={}, label="Floppy drives" })