From 4e764369328e1859f84872bb3e6527ecb7fc5e5b Mon Sep 17 00:00:00 2001 From: ohrensessel Date: Mon, 18 Aug 2014 11:40:13 +0200 Subject: [PATCH] add overlay usage to statistics.d --- .../files/lib/gluon/announce/statistics.d/overlay | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 package/gluon-announce/files/lib/gluon/announce/statistics.d/overlay diff --git a/package/gluon-announce/files/lib/gluon/announce/statistics.d/overlay b/package/gluon-announce/files/lib/gluon/announce/statistics.d/overlay new file mode 100644 index 00000000..7dc6eed0 --- /dev/null +++ b/package/gluon-announce/files/lib/gluon/announce/statistics.d/overlay @@ -0,0 +1,7 @@ +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 + +return math.floor(used * 1000 + 0.5) / 1000