From 0e95c90e2100edd96e3001cea1e2fd5861181fda Mon Sep 17 00:00:00 2001 From: ohrensessel Date: Mon, 18 Aug 2014 12:10:54 +0200 Subject: [PATCH] overlay: change to normalized, fix error handling --- .../files/lib/gluon/announce/statistics.d/overlay | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/gluon-announce/files/lib/gluon/announce/statistics.d/overlay b/package/gluon-announce/files/lib/gluon/announce/statistics.d/overlay index 7dc6eed0..6f1b7edf 100644 --- a/package/gluon-announce/files/lib/gluon/announce/statistics.d/overlay +++ b/package/gluon-announce/files/lib/gluon/announce/statistics.d/overlay @@ -2,6 +2,8 @@ local fs = require "nixio.fs" local opkg = require "luci.model.ipkg" local st = fs.statvfs(opkg.overlay_root()) -local used = 100*((st.blocks - st.bfree) / st.blocks) or 0 +local blocks = st.blockss or 0 +local bfree = st.bfree or 0 +local used = ((blocks - bfree) / blocks) return math.floor(used * 1000 + 0.5) / 1000