[helpers.lua] Removed old sysctl functions
This commit is contained in:
parent
d6e21f71d0
commit
875e98e24e
|
@ -26,6 +26,11 @@ Fixed:
|
|||
- [pkg,weather,contrib/btc] Allow function call without Awesome
|
||||
- [pkg] Use more updated front-ends for Debian/Ubuntu (apt) and Fedora (dnf)
|
||||
|
||||
Removed:
|
||||
- `helpers.sysctl` and `helpers.sysctl_table` were removed in favour of
|
||||
`helpers.sysctl_async`.
|
||||
|
||||
|
||||
# Changes in 2.3.3
|
||||
|
||||
Feature: Add battery widget type for OpenBSD
|
||||
|
|
38
helpers.lua
38
helpers.lua
|
@ -226,44 +226,6 @@ function helpers.scroll(text, maxlen, widget)
|
|||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Return result from one sysctl variable as string
|
||||
function helpers.sysctl(path)
|
||||
local fd = io.popen("sysctl -n " .. helpers.shellquote(path))
|
||||
|
||||
if not fd then
|
||||
return
|
||||
end
|
||||
|
||||
local ret = fd:read()
|
||||
|
||||
fd:close()
|
||||
|
||||
return ret
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Return result from multiple sysctl variables as table
|
||||
function helpers.sysctl_table(syspath)
|
||||
return setmetatable({ _path = syspath },
|
||||
{ __index = function(table, index)
|
||||
local path = "sysctl -n " .. helpers.shellquote(table._path .. "." .. index)
|
||||
local f = io.popen(path)
|
||||
if f then
|
||||
local s = f:read("*all")
|
||||
f:close()
|
||||
if select(2, s:gsub("\n", "\n")) > 1 then
|
||||
local o = { _path = path}
|
||||
setmetatable(o, getmetatable(table))
|
||||
return o
|
||||
else
|
||||
return s
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Return result from sysctl variable as table (async)
|
||||
function helpers.sysctl_async(path_table, parse)
|
||||
local ret = {}
|
||||
|
|
Loading…
Reference in New Issue