autocore: minor cleanup
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org> (cherry picked from commit 42e2aaf2b30fa6a5f3b8357a103712faef81814e)
This commit is contained in:
parent
8bb9ae62d6
commit
543c8e7a28
@ -36,10 +36,8 @@ endef
|
|||||||
|
|
||||||
define Package/autocore/install/Default
|
define Package/autocore/install/Default
|
||||||
$(INSTALL_DIR) $(1)/etc
|
$(INSTALL_DIR) $(1)/etc
|
||||||
$(CP) ./files/generic/rpcd_10_system.js $(1)/etc/
|
$(CP) ./files/generic/10_system.js $(1)/etc/rpcd_10_system.js
|
||||||
$(CP) ./files/generic/rpcd_21_ethinfo.js $(1)/etc/
|
$(CP) ./files/generic/luci $(1)/etc/rpcd_luci
|
||||||
$(CP) ./files/generic/rpcd_luci $(1)/etc/
|
|
||||||
$(CP) ./files/generic/rpcd_luci-mod-status.json $(1)/etc/
|
|
||||||
|
|
||||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||||
$(INSTALL_BIN) ./files/generic/090-cover-index_files $(1)/etc/uci-defaults/
|
$(INSTALL_BIN) ./files/generic/090-cover-index_files $(1)/etc/uci-defaults/
|
||||||
@ -47,6 +45,12 @@ define Package/autocore/install/Default
|
|||||||
$(INSTALL_DIR) $(1)/sbin
|
$(INSTALL_DIR) $(1)/sbin
|
||||||
$(INSTALL_BIN) ./files/generic/cpuinfo $(1)/sbin/
|
$(INSTALL_BIN) ./files/generic/cpuinfo $(1)/sbin/
|
||||||
$(INSTALL_BIN) ./files/generic/ethinfo $(1)/sbin/
|
$(INSTALL_BIN) ./files/generic/ethinfo $(1)/sbin/
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
|
||||||
|
$(CP) ./files/generic/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/www/luci-static/resources/view/status/include
|
||||||
|
$(INSTALL_DATA) ./files/generic/21_ethinfo.js $(1)/www/luci-static/resources/view/status/include/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/autocore-arm/install
|
define Package/autocore-arm/install
|
||||||
@ -54,7 +58,7 @@ define Package/autocore-arm/install
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/autocore-x86/install
|
define Package/autocore-x86/install
|
||||||
$(call Package/autocore/install/Default)
|
$(call Package/autocore/install/Default,$(1))
|
||||||
|
|
||||||
$(INSTALL_DIR) $(1)/etc/init.d
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
$(INSTALL_BIN) ./files/x86/autocore $(1)/etc/init.d/
|
$(INSTALL_BIN) ./files/x86/autocore $(1)/etc/init.d/
|
||||||
|
@ -2,12 +2,8 @@
|
|||||||
|
|
||||||
[ ! -f '/etc/rpcd_10_system.js' ] || \
|
[ ! -f '/etc/rpcd_10_system.js' ] || \
|
||||||
mv -f '/etc/rpcd_10_system.js' '/www/luci-static/resources/view/status/include/10_system.js'
|
mv -f '/etc/rpcd_10_system.js' '/www/luci-static/resources/view/status/include/10_system.js'
|
||||||
[ ! -f '/etc/rpcd_21_ethinfo.js' ] || \
|
|
||||||
mv -f '/etc/rpcd_21_ethinfo.js' '/www/luci-static/resources/view/status/include/21_ethinfo.js'
|
|
||||||
[ ! -f '/etc/rpcd_luci' ] || \
|
[ ! -f '/etc/rpcd_luci' ] || \
|
||||||
mv -f '/etc/rpcd_luci' '/usr/libexec/rpcd/luci'
|
mv -f '/etc/rpcd_luci' '/usr/libexec/rpcd/luci'
|
||||||
[ ! -f '/etc/rpcd_luci-mod-status.json' ] || \
|
|
||||||
mv -f '/etc/rpcd_luci-mod-status.json' '/usr/share/rpcd/acl.d/luci-mod-status.json'
|
|
||||||
/etc/init.d/rpcd restart
|
/etc/init.d/rpcd restart
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -73,8 +73,8 @@ return baseclass.extend({
|
|||||||
|
|
||||||
var fields = [
|
var fields = [
|
||||||
_('Hostname'), boardinfo.hostname,
|
_('Hostname'), boardinfo.hostname,
|
||||||
_('Model'), boardinfo.model + cpubench.cpubench,
|
_('Model'), boardinfo.model + cpubench,
|
||||||
_('Architecture'), cpuinfo.cpuinfo,
|
_('Architecture'), cpuinfo,
|
||||||
_('Target Platform'), (L.isObject(boardinfo.release) ? boardinfo.release.target : ''),
|
_('Target Platform'), (L.isObject(boardinfo.release) ? boardinfo.release.target : ''),
|
||||||
_('Firmware Version'), (L.isObject(boardinfo.release) ? boardinfo.release.description + ' / ' : '') + (luciversion || ''),
|
_('Firmware Version'), (L.isObject(boardinfo.release) ? boardinfo.release.description + ' / ' : '') + (luciversion || ''),
|
||||||
_('Kernel Version'), boardinfo.kernel,
|
_('Kernel Version'), boardinfo.kernel,
|
||||||
@ -85,7 +85,7 @@ return baseclass.extend({
|
|||||||
systeminfo.load[1] / 65535.0,
|
systeminfo.load[1] / 65535.0,
|
||||||
systeminfo.load[2] / 65535.0
|
systeminfo.load[2] / 65535.0
|
||||||
) : null,
|
) : null,
|
||||||
_('CPU usage (%)'), cpuusage.cpuusage
|
_('CPU usage (%)'), cpuusage
|
||||||
];
|
];
|
||||||
|
|
||||||
var table = E('table', { 'class': 'table' });
|
var table = E('table', { 'class': 'table' });
|
@ -1,4 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
'require baseclass';
|
||||||
'require rpc';
|
'require rpc';
|
||||||
|
|
||||||
var callLuciETHInfo = rpc.declare({
|
var callLuciETHInfo = rpc.declare({
|
@ -618,9 +618,8 @@ local methods = {
|
|||||||
getCPUBench = {
|
getCPUBench = {
|
||||||
call = function()
|
call = function()
|
||||||
local sys = require "luci.sys"
|
local sys = require "luci.sys"
|
||||||
local cpubench = {}
|
local cpubench = sys.exec("cat /etc/bench.log 2>/dev/null") or ""
|
||||||
|
|
||||||
cpubench.cpubench = sys.exec("cat /etc/bench.log 2>/dev/null")
|
|
||||||
return cpubench
|
return cpubench
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
@ -628,12 +627,10 @@ local methods = {
|
|||||||
getCPUInfo = {
|
getCPUInfo = {
|
||||||
call = function()
|
call = function()
|
||||||
local sys = require "luci.sys"
|
local sys = require "luci.sys"
|
||||||
local cpuinfo = {}
|
local cpuinfo = sys.exec("/sbin/cpuinfo")
|
||||||
|
|
||||||
cpuinfo.cpuinfo = sys.exec("/sbin/cpuinfo")
|
if (cpuinfo == nil) or (cpuinfo == "") then
|
||||||
|
cpuinfo.cpuinfo = "? x ? (2.33MHz, 2.33°C)"
|
||||||
if (cpuinfo.cpuinfo == nil) or (cpuinfo.cpuinfo == "") then
|
|
||||||
cpuinfo.cpuinfo = "2.33 MHz +2.33 C"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return cpuinfo
|
return cpuinfo
|
||||||
@ -643,9 +640,8 @@ local methods = {
|
|||||||
getCPUUsage = {
|
getCPUUsage = {
|
||||||
call = function()
|
call = function()
|
||||||
local sys = require "luci.sys"
|
local sys = require "luci.sys"
|
||||||
local cpuusage = {}
|
local cpuusage = sys.exec("top -n1 | awk '/^CPU/ {printf(\"%d%%\", 100 - $8)}'") or "6%"
|
||||||
|
|
||||||
cpuusage.cpuusage = sys.exec("top -n1 | awk '/^CPU/ {printf(\"%d%\", 100 - $8)}'") or "6%"
|
|
||||||
return cpuusage
|
return cpuusage
|
||||||
end
|
end
|
||||||
},
|
},
|
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"luci-mod-status-autocore": {
|
||||||
|
"description": "Grant access to autocore",
|
||||||
|
"read": {
|
||||||
|
"ubus": {
|
||||||
|
"luci": [ "getCPUInfo", "getETHInfo", "getTempInfo" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,144 +0,0 @@
|
|||||||
{
|
|
||||||
"luci-mod-status-realtime": {
|
|
||||||
"description": "Grant access to realtime statistics",
|
|
||||||
"read": {
|
|
||||||
"ubus": {
|
|
||||||
"luci": [ "getConntrackList", "getRealtimeStats", "getCPUBench", "getCPUInfo", "getCPUUsage", "getETHInfo", "getOnlineUsers" ],
|
|
||||||
"network.rrdns": [ "lookup" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"luci-mod-status-processes": {
|
|
||||||
"description": "Grant access to process status",
|
|
||||||
"read": {
|
|
||||||
"ubus": {
|
|
||||||
"luci": [ "getProcessList" ]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"write": {
|
|
||||||
"file": {
|
|
||||||
"/bin/kill": [ "exec" ]
|
|
||||||
},
|
|
||||||
"ubus": {
|
|
||||||
"file": [ "exec" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"luci-mod-status-logs": {
|
|
||||||
"description": "Grant access to system logs",
|
|
||||||
"read": {
|
|
||||||
"cgi-io": [ "exec" ],
|
|
||||||
"file": {
|
|
||||||
"/bin/dmesg -r": [ "exec" ],
|
|
||||||
"/sbin/logread": [ "stat" ],
|
|
||||||
"/sbin/logread -e ^": [ "exec" ],
|
|
||||||
"/usr/sbin/logread": [ "stat" ],
|
|
||||||
"/usr/sbin/logread -e ^": [ "exec" ]
|
|
||||||
},
|
|
||||||
"ubus": {
|
|
||||||
"file": [ "stat" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"luci-mod-status-routes": {
|
|
||||||
"description": "Grant access to the system route status",
|
|
||||||
"read": {
|
|
||||||
"file": {
|
|
||||||
"/sbin/ip -[46] neigh show": [ "exec" ],
|
|
||||||
"/sbin/ip -[46] route show table all": [ "exec" ]
|
|
||||||
},
|
|
||||||
"ubus": {
|
|
||||||
"file": [ "exec" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"luci-mod-status-channel_analysis": {
|
|
||||||
"description": "Grant access to wireless channel status",
|
|
||||||
"read": {
|
|
||||||
"ubus": {
|
|
||||||
"iwinfo": [ "info", "freqlist" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"luci-mod-status-firewall": {
|
|
||||||
"description": "Grant access to firewall status",
|
|
||||||
"read": {
|
|
||||||
"cgi-io": [ "exec" ],
|
|
||||||
"file": {
|
|
||||||
"/usr/sbin/iptables --line-numbers -w -nvxL -t *": [ "exec" ],
|
|
||||||
"/usr/sbin/ip6tables --line-numbers -w -nvxL -t *": [ "exec" ],
|
|
||||||
"/usr/sbin/ip6tables": [ "list" ]
|
|
||||||
},
|
|
||||||
"ubus": {
|
|
||||||
"file": [ "stat" ]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"write": {
|
|
||||||
"cgi-io": [ "exec" ],
|
|
||||||
"file": {
|
|
||||||
"/etc/init.d/firewall restart": [ "exec" ],
|
|
||||||
"/usr/sbin/iptables -Z": [ "exec" ],
|
|
||||||
"/usr/sbin/ip6tables -Z": [ "exec" ]
|
|
||||||
},
|
|
||||||
"ubus": {
|
|
||||||
"file": [ "exec" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"luci-mod-status-index": {
|
|
||||||
"description": "Grant access to main status display",
|
|
||||||
"read": {
|
|
||||||
"file": {
|
|
||||||
"/proc/sys/net/netfilter/nf_conntrack_count": [ "read" ],
|
|
||||||
"/proc/sys/net/netfilter/nf_conntrack_max": [ "read" ],
|
|
||||||
"/usr/lib/lua/luci/version.lua": [ "read" ],
|
|
||||||
"/www/luci-static/resources/view/status/include": [ "list" ]
|
|
||||||
},
|
|
||||||
"ubus": {
|
|
||||||
"file": [ "list", "read" ],
|
|
||||||
"system": [ "board", "info" ]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"write": {
|
|
||||||
"uci": [ "dhcp" ]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"luci-mod-status-index-dhcp": {
|
|
||||||
"description": "Grant access to DHCP status display",
|
|
||||||
"read": {
|
|
||||||
"ubus": {
|
|
||||||
"luci-rpc": [ "getDHCPLeases" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"luci-mod-status-index-dsl": {
|
|
||||||
"description": "Grant access to DSL status display",
|
|
||||||
"read": {
|
|
||||||
"ubus": {
|
|
||||||
"dsl": [ "metrics" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"luci-mod-status-index-wifi": {
|
|
||||||
"description": "Grant access to wireless status display",
|
|
||||||
"read": {
|
|
||||||
"ubus": {
|
|
||||||
"iwinfo": [ "assoclist" ]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"write": {
|
|
||||||
"ubus": {
|
|
||||||
"hostapd.*": [ "del_client", "wps_start", "wps_cancel", "wps_status" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user