Merge pull request #3158 from dibdot/banIP
[oweals/luci.git] / modules / luci-base / luasrc / sys.lua
index cd186c94d2bae1a8702108cea914701fe443297e..f82cd78cb7bc5af933dc9f9f9f8c8d1a4849bb29 100644 (file)
@@ -25,69 +25,6 @@ end
 
 exec = luci.util.exec
 
-function mounts()
-       local data = {}
-       local k = {"fs", "blocks", "used", "available", "percent", "mountpoint"}
-       local ps = luci.util.execi("df")
-
-       if not ps then
-               return
-       else
-               ps()
-       end
-
-       for line in ps do
-               local row = {}
-
-               local j = 1
-               for value in line:gmatch("[^%s]+") do
-                       row[k[j]] = value
-                       j = j + 1
-               end
-
-               if row[k[1]] then
-
-                       -- this is a rather ugly workaround to cope with wrapped lines in
-                       -- the df output:
-                       --
-                       --      /dev/scsi/host0/bus0/target0/lun0/part3
-                       --                   114382024  93566472  15005244  86% /mnt/usb
-                       --
-
-                       if not row[k[2]] then
-                               j = 2
-                               line = ps()
-                               for value in line:gmatch("[^%s]+") do
-                                       row[k[j]] = value
-                                       j = j + 1
-                               end
-                       end
-
-                       table.insert(data, row)
-               end
-       end
-
-       return data
-end
-
-function mtds()
-       local data = {}
-
-       if fs.access("/proc/mtd") then
-               for l in io.lines("/proc/mtd") do
-                       local d, s, e, n = l:match('^([^%s]+)%s+([^%s]+)%s+([^%s]+)%s+"([^%s]+)"')
-                       if s and n then
-                               local d = {}
-                               d.size = tonumber(s, 16)
-                               d.name = n
-                               table.insert(data, d)
-                       end
-               end
-       end
-
-       return data
-end
-
 -- containing the whole environment is returned otherwise this function returns
 -- the corresponding string value for the given name or nil if no such variable
 -- exists.
@@ -189,7 +126,7 @@ local function _nethints(what, callback)
                        end
                end
        )
-       
+
        cur:foreach("dhcp", "odhcpd",
                function(s)
                        if type(s.leasefile) == "string" and fs.access(s.leasefile) then
@@ -645,7 +582,7 @@ function init.enabled(name)
 end
 
 function init.enable(name)
-       return (init_action("enable", name) == 1)
+       return (init_action("enable", name) == 0)
 end
 
 function init.disable(name)
@@ -659,3 +596,11 @@ end
 function init.stop(name)
        return (init_action("stop", name) == 0)
 end
+
+function init.restart(name)
+       return (init_action("restart", name) == 0)
+end
+
+function init.reload(name)
+       return (init_action("reload", name) == 0)
+end