autocore: remove 10_system hack

It's now merged into luci feed.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2022-10-25 18:42:27 +08:00
parent 08b6c139d5
commit 79f50ce7df
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
4 changed files with 6 additions and 125 deletions

View File

@ -38,11 +38,8 @@ define Build/Compile
endef
define Package/autocore/install/Default
$(INSTALL_DIR) $(1)/etc
$(CP) ./files/generic/10_system.js $(1)/etc/rpcd_10_system.js
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/generic/090-cover-index_files $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/generic/60-autocore-reload-rpcd $(1)/etc/uci-defaults/
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) ./files/generic/cpuinfo $(1)/sbin/

View File

@ -1,7 +0,0 @@
#!/bin/sh
[ ! -f '/etc/rpcd_10_system.js' ] || \
mv -f '/etc/rpcd_10_system.js' '/www/luci-static/resources/view/status/include/10_system.js'
/etc/init.d/rpcd restart
exit 0

View File

@ -1,114 +0,0 @@
'use strict';
'require baseclass';
'require fs';
'require rpc';
var callSystemBoard = rpc.declare({
object: 'system',
method: 'board'
});
var callSystemInfo = rpc.declare({
object: 'system',
method: 'info'
});
var callCPUBench = rpc.declare({
object: 'luci',
method: 'getCPUBench'
});
var callCPUInfo = rpc.declare({
object: 'luci',
method: 'getCPUInfo'
});
var callCPUUsage = rpc.declare({
object: 'luci',
method: 'getCPUUsage'
});
var callTempInfo = rpc.declare({
object: 'luci',
method: 'getTempInfo'
});
return baseclass.extend({
title: _('System'),
load: function() {
return Promise.all([
L.resolveDefault(callSystemBoard(), {}),
L.resolveDefault(callSystemInfo(), {}),
L.resolveDefault(callCPUBench(), {}),
L.resolveDefault(callCPUInfo(), {}),
L.resolveDefault(callCPUUsage(), {}),
L.resolveDefault(callTempInfo(), {}),
fs.lines('/usr/lib/lua/luci/version.lua')
]);
},
render: function(data) {
var boardinfo = data[0],
systeminfo = data[1],
cpubench = data[2],
cpuinfo = data[3],
cpuusage = data[4],
tempinfo = data[5],
luciversion = data[6];
luciversion = luciversion.filter(function(l) {
return l.match(/^\s*(luciname|luciversion)\s*=/);
}).map(function(l) {
return l.replace(/^\s*\w+\s*=\s*['"]([^'"]+)['"].*$/, '$1');
}).join(' ');
var datestr = null;
if (systeminfo.localtime) {
var date = new Date(systeminfo.localtime * 1000);
datestr = '%04d-%02d-%02d %02d:%02d:%02d'.format(
date.getUTCFullYear(),
date.getUTCMonth() + 1,
date.getUTCDate(),
date.getUTCHours(),
date.getUTCMinutes(),
date.getUTCSeconds()
);
}
var fields = [
_('Hostname'), boardinfo.hostname,
_('Model'), boardinfo.model + cpubench.cpubench,
_('Architecture'), cpuinfo.cpuinfo,
_('Target Platform'), (L.isObject(boardinfo.release) ? boardinfo.release.target : ''),
_('Firmware Version'), (L.isObject(boardinfo.release) ? boardinfo.release.description + ' / ' : '') + (luciversion || ''),
_('Kernel Version'), boardinfo.kernel,
_('Local Time'), datestr,
_('Uptime'), systeminfo.uptime ? '%t'.format(systeminfo.uptime) : null,
_('Load Average'), Array.isArray(systeminfo.load) ? '%.2f, %.2f, %.2f'.format(
systeminfo.load[0] / 65535.0,
systeminfo.load[1] / 65535.0,
systeminfo.load[2] / 65535.0
) : null,
_('CPU usage (%)'), cpuusage.cpuusage
];
if (tempinfo.tempinfo) {
fields.splice(6, 0, _('Temperature'));
fields.splice(7, 0, tempinfo.tempinfo);
}
var table = E('table', { 'class': 'table' });
for (var i = 0; i < fields.length; i += 2) {
table.appendChild(E('tr', { 'class': 'tr' }, [
E('td', { 'class': 'td left', 'width': '33%' }, [ fields[i] ]),
E('td', { 'class': 'td left' }, [ (fields[i + 1] != null) ? fields[i + 1] : '?' ])
]));
}
return table;
}
});

View File

@ -0,0 +1,5 @@
#!/bin/sh
/etc/init.d/rpcd restart
exit 0