modules/admin-mini: some work on lan and wan configuration
[project/luci.git] / modules / freifunk / luasrc / controller / freifunk / luciinfo.lua
index c4c6276..4ab63a0 100644 (file)
@@ -1,3 +1,16 @@
+--[[
+LuCI - Lua Configuration Interface
+
+Copyright 2008 Steven Barth <steven@midlink.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+]]--
 module("luci.controller.freifunk.luciinfo", package.seeall)
 
 function index()
@@ -5,13 +18,12 @@ function index()
 end
 
 function action_index()
-       local uci = luci.model.uci.StateSession()
-
+       local uci = luci.model.uci
        luci.http.prepare_content("text/plain")
        
        -- General
-       print("luciinfo.api=1")
-       print("luciinfo.version=" .. tostring(require("luci").__version__))
+       luci.http.write("luciinfo.api=1\n")
+       luci.http.write("luciinfo.version=" .. tostring(require("luci").__version__) .. "\n")
        
        -- Sysinfo
        local s, m, r = luci.sys.sysinfo()
@@ -19,22 +31,22 @@ function action_index()
        dr = dr and luci.sys.net.hexip4(dr.Gateway) or ""
        local l1, l5, l15 = luci.sys.loadavg()
        
-       print("sysinfo.system=" .. sanitize(s))
-       print("sysinfo.cpu=" .. sanitize(m))
-       print("sysinfo.ram=" .. sanitize(r))
-       print("sysinfo.hostname=" .. sanitize(luci.sys.hostname()))
-       print("sysinfo.load1=" .. tostring(l1))
-       print("sysinfo.load5=" .. tostring(l5))
-       print("sysinfo.load15=" .. tostring(l15))
-       print("sysinfo.defaultgw=" .. dr)
+       luci.http.write("sysinfo.system=" .. sanitize(s) .. "\n")
+       luci.http.write("sysinfo.cpu=" .. sanitize(m) .. "\n")
+       luci.http.write("sysinfo.ram=" .. sanitize(r) .. "\n")
+       luci.http.write("sysinfo.hostname=" .. sanitize(luci.sys.hostname()) .. "\n")
+       luci.http.write("sysinfo.load1=" .. tostring(l1) .. "\n")
+       luci.http.write("sysinfo.load5=" .. tostring(l5) .. "\n")
+       luci.http.write("sysinfo.load15=" .. tostring(l15) .. "\n")
+       luci.http.write("sysinfo.defaultgw=" .. dr .. "\n")
 
        
        -- Freifunk
-       local ff = uci:sections("freifunk") or {}
+       local ff = uci.get_all("freifunk") or {}
        for k, v in pairs(ff) do
                        for i, j in pairs(v) do
                                if i:sub(1, 1) ~= "." then
-                                       print("freifunk." .. k .. "." .. i .. "=" .. j)
+                                       luci.http.write("freifunk." .. k .. "." .. i .. "=" .. j .. "\n")
                                end
                        end
        end