diff --git a/package/emortal/autocore/Makefile b/package/emortal/autocore/Makefile index 9bf79403b3..57f79a0164 100644 --- a/package/emortal/autocore/Makefile +++ b/package/emortal/autocore/Makefile @@ -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/ diff --git a/package/emortal/autocore/files/generic/090-cover-index_files b/package/emortal/autocore/files/generic/090-cover-index_files deleted file mode 100755 index 01b5976f17..0000000000 --- a/package/emortal/autocore/files/generic/090-cover-index_files +++ /dev/null @@ -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 diff --git a/package/emortal/autocore/files/generic/10_system.js b/package/emortal/autocore/files/generic/10_system.js deleted file mode 100644 index 03526498d2..0000000000 --- a/package/emortal/autocore/files/generic/10_system.js +++ /dev/null @@ -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; - } -}); diff --git a/package/emortal/autocore/files/generic/60-autocore-reload-rpcd b/package/emortal/autocore/files/generic/60-autocore-reload-rpcd new file mode 100755 index 0000000000..75e8178bb8 --- /dev/null +++ b/package/emortal/autocore/files/generic/60-autocore-reload-rpcd @@ -0,0 +1,5 @@ +#!/bin/sh + +/etc/init.d/rpcd restart + +exit 0