added NetBSD support
This commit is contained in:
+2
-1
@@ -24,6 +24,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
module.exports = function (callback) {
|
||||
@@ -101,7 +102,7 @@ module.exports = function (callback) {
|
||||
resolve(result);
|
||||
}
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
exec('sysctl hw.acpi.battery hw.acpi.acline', function (error, stdout) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
const batteries = parseInt('0' + util.getValue(lines, 'hw.acpi.battery.units'), 10);
|
||||
|
||||
+5
-4
@@ -25,6 +25,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
let _cpu_speed = '0.00';
|
||||
@@ -355,7 +356,7 @@ function getCpu() {
|
||||
});
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
let modelline = '';
|
||||
let lines = [];
|
||||
if (os.cpus()[0] && os.cpus()[0].model) modelline = os.cpus()[0].model;
|
||||
@@ -659,7 +660,7 @@ function cpuTemperature(callback) {
|
||||
}
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
exec('sysctl dev.cpu | grep temp', function (error, stdout) {
|
||||
if (!error) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
@@ -792,7 +793,7 @@ function cpuFlags(callback) {
|
||||
}
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
exec('export LC_ALL=C; dmidecode -t 4 2>/dev/null; unset LC_ALL', function (error, stdout) {
|
||||
let flags = [];
|
||||
if (!error) {
|
||||
@@ -870,7 +871,7 @@ function cpuCache(callback) {
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
exec('export LC_ALL=C; dmidecode -t 7 2>/dev/null; unset LC_ALL', function (error, stdout) {
|
||||
let cache = [];
|
||||
if (!error) {
|
||||
|
||||
+10
-9
@@ -24,6 +24,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
const NOT_SUPPORTED = 'not supported';
|
||||
@@ -39,11 +40,11 @@ function fsSize(callback) {
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
let data = [];
|
||||
if (_linux || _freebsd || _openbsd || _darwin) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
|
||||
let cmd = '';
|
||||
if (_darwin) cmd = 'df -lkP | grep ^/';
|
||||
if (_linux) cmd = 'df -lkPT | grep ^/';
|
||||
if (_freebsd || _openbsd) cmd = 'df -lkPT';
|
||||
if (_freebsd || _openbsd || _netbsd) cmd = 'df -lkPT';
|
||||
exec(cmd, function (error, stdout) {
|
||||
if (!error) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
@@ -54,10 +55,10 @@ function fsSize(callback) {
|
||||
if (line && (line[0].startsWith('/')) || (line[6] && line[6] === '/')) {
|
||||
data.push({
|
||||
'fs': line[0],
|
||||
'type': ((_linux || _freebsd || _openbsd) ? line[1] : 'HFS'),
|
||||
'size': parseInt(((_linux || _freebsd || _openbsd) ? line[2] : line[1])) * 1024,
|
||||
'used': parseInt(((_linux || _freebsd || _openbsd) ? line[3] : line[2])) * 1024,
|
||||
'use': parseFloat((100.0 * ((_linux || _freebsd || _openbsd) ? line[3] : line[2]) / ((_linux || _freebsd || _openbsd) ? line[2] : line[1])).toFixed(2)),
|
||||
'type': ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : 'HFS'),
|
||||
'size': parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])) * 1024,
|
||||
'used': parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2])) * 1024,
|
||||
'use': parseFloat((100.0 * ((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2]) / ((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])).toFixed(2)),
|
||||
'mount': line[line.length - 1]
|
||||
});
|
||||
}
|
||||
@@ -119,7 +120,7 @@ function fsOpenFiles(callback) {
|
||||
allocated: -1,
|
||||
available: -1
|
||||
};
|
||||
if (_freebsd || _openbsd || _darwin) {
|
||||
if (_freebsd || _openbsd || _netbsd || _darwin) {
|
||||
let cmd = 'sysctl -a | grep \'kern.*files\'';
|
||||
exec(cmd, function (error, stdout) {
|
||||
if (!error) {
|
||||
@@ -587,7 +588,7 @@ function disksIO(callback) {
|
||||
let wIO = 0;
|
||||
|
||||
if ((_disk_io && !_disk_io.ms) || (_disk_io && _disk_io.ms && Date.now() - _disk_io.ms >= 500)) {
|
||||
if (_linux || _freebsd || _openbsd) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
// prints Block layer statistics for all mounted volumes
|
||||
// var cmd = "for mount in `lsblk | grep / | sed -r 's/│ └─//' | cut -d ' ' -f 1`; do cat /sys/block/$mount/stat | sed -r 's/ +/;/g' | sed -r 's/^;//'; done";
|
||||
// var cmd = "for mount in `lsblk | grep / | sed 's/[│└─├]//g' | awk '{$1=$1};1' | cut -d ' ' -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r 's/ +/;/g' | sed -r 's/^;//'; done";
|
||||
@@ -802,7 +803,7 @@ function diskLayout(callback) {
|
||||
}
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
if (callback) { callback(result); }
|
||||
resolve(result);
|
||||
}
|
||||
|
||||
+2
-1
@@ -24,6 +24,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
let _resolutionx = 0;
|
||||
@@ -461,7 +462,7 @@ function graphics(callback) {
|
||||
});
|
||||
}
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
if (callback) { callback(result); }
|
||||
resolve(result);
|
||||
}
|
||||
|
||||
+5
-4
@@ -40,6 +40,7 @@ let _platform = process.platform;
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
@@ -139,7 +140,7 @@ function getDynamicData(srv, iface, callback) {
|
||||
let functionProcessed = (function () {
|
||||
let totalFunctions = 14;
|
||||
if (_windows) totalFunctions = 10;
|
||||
if (_freebsd || _openbsd) totalFunctions = 11;
|
||||
if (_freebsd || _openbsd || _netbsd) totalFunctions = 11;
|
||||
if (_sunos) totalFunctions = 6;
|
||||
|
||||
return function () {
|
||||
@@ -203,7 +204,7 @@ function getDynamicData(srv, iface, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
if (!_openbsd && !_freebsd && !_sunos) {
|
||||
if (!_openbsd && !_freebsd && !_netbsd && !_sunos) {
|
||||
network.networkStats(iface).then(res => {
|
||||
data.networkStats = res;
|
||||
functionProcessed();
|
||||
@@ -243,14 +244,14 @@ function getDynamicData(srv, iface, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
if (!_windows && !_openbsd && !_freebsd && !_sunos) {
|
||||
if (!_windows && !_openbsd && !_freebsd && !_netbsd && !_sunos) {
|
||||
filesystem.fsStats().then(res => {
|
||||
data.fsStats = res;
|
||||
functionProcessed();
|
||||
});
|
||||
}
|
||||
|
||||
if (!_windows && !_openbsd && !_freebsd && !_sunos) {
|
||||
if (!_windows && !_openbsd && !_freebsd && !_netbsd && !_sunos) {
|
||||
filesystem.disksIO().then(res => {
|
||||
data.disksIO = res;
|
||||
functionProcessed();
|
||||
|
||||
+4
-3
@@ -23,6 +23,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
// --------------------------
|
||||
@@ -42,7 +43,7 @@ function inetChecksite(url, callback) {
|
||||
if (url) {
|
||||
url = url.toLowerCase();
|
||||
let t = Date.now();
|
||||
if (_linux || _freebsd || _openbsd || _darwin || _sunos) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd || _darwin || _sunos) {
|
||||
let args = ' -I --connect-timeout 5 -m 5 ' + url + ' 2>/dev/null | head -n 1 | cut -d " " -f2';
|
||||
let cmd = 'curl';
|
||||
exec(cmd + args, function (error, stdout) {
|
||||
@@ -111,11 +112,11 @@ function inetLatency(host, callback) {
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
let cmd;
|
||||
if (_linux || _freebsd || _openbsd || _darwin) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
|
||||
if (_linux) {
|
||||
cmd = 'ping -c 2 -w 3 ' + host + ' | grep rtt';
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
cmd = 'ping -c 2 -t 3 ' + host + ' | grep round-trip';
|
||||
}
|
||||
if (_darwin) {
|
||||
|
||||
+3
-2
@@ -24,6 +24,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
const OSX_RAM_manufacturers = {
|
||||
@@ -158,7 +159,7 @@ function mem(callback) {
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
exec('/sbin/sysctl -a | grep -E "hw.realmem|hw.physmem|vm.stats.vm.v_page_count|vm.stats.vm.v_wire_count|vm.stats.vm.v_active_count|vm.stats.vm.v_inactive_count|vm.stats.vm.v_cache_count|vm.stats.vm.v_free_count|vm.stats.vm.v_page_size"', function (error, stdout) {
|
||||
if (!error) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
@@ -260,7 +261,7 @@ function memLayout(callback) {
|
||||
|
||||
let result = [];
|
||||
|
||||
if (_linux || _freebsd || _openbsd) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
exec('export LC_ALL=C; dmidecode -t memory 2>/dev/null | grep -iE "Size:|Type|Speed|Manufacturer|Form Factor|Locator|Memory Device|Serial Number|Voltage|Part Number"; unset LC_ALL', function (error, stdout) {
|
||||
if (!error) {
|
||||
let devices = stdout.toString().split('Memory Device');
|
||||
|
||||
+8
-7
@@ -26,6 +26,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
let _network = {};
|
||||
@@ -58,11 +59,11 @@ function getDefaultNetworkInterface() {
|
||||
}
|
||||
}
|
||||
ifacename = ifacename || ifacenameFirst || '';
|
||||
if (_linux || _darwin || _freebsd || _openbsd || _sunos) {
|
||||
if (_linux || _darwin || _freebsd || _openbsd || _netbsd || _sunos) {
|
||||
let cmd = '';
|
||||
if (_linux) cmd = 'ip route 2> /dev/null | grep default | awk \'{print $5}\'';
|
||||
if (_darwin) cmd = 'route get 0.0.0.0 2>/dev/null | grep interface: | awk \'{print $2}\'';
|
||||
if (_freebsd || _openbsd || _sunos) cmd = 'route get 0.0.0.0 | grep interface:';
|
||||
if (_freebsd || _openbsd || _netbsd || _sunos) cmd = 'route get 0.0.0.0 | grep interface:';
|
||||
let result = execSync(cmd);
|
||||
ifacename = result.toString().split('\n')[0];
|
||||
if (ifacename.indexOf(':') > -1) {
|
||||
@@ -80,7 +81,7 @@ function getMacAddresses() {
|
||||
let iface = '';
|
||||
let mac = '';
|
||||
let result = {};
|
||||
if (_linux || _freebsd || _openbsd) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
if (typeof pathToIp === 'undefined') {
|
||||
try {
|
||||
const lines = execSync('which ip').toString().split('\n');
|
||||
@@ -384,7 +385,7 @@ function networkInterfaces(callback) {
|
||||
type = 'wireless';
|
||||
}
|
||||
}
|
||||
if (_darwin || _freebsd || _openbsd) {
|
||||
if (_darwin || _freebsd || _openbsd || _netbsd) {
|
||||
nics.forEach(nic => {
|
||||
if (nic.iface === dev) {
|
||||
mtu = nic.mtu;
|
||||
@@ -595,7 +596,7 @@ function networkStatsSingle(iface) {
|
||||
resolve(result);
|
||||
}
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
cmd = 'netstat -ibndI ' + iface;
|
||||
exec(cmd, function (error, stdout) {
|
||||
if (!error) {
|
||||
@@ -707,9 +708,9 @@ function networkConnections(callback) {
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
let result = [];
|
||||
if (_linux || _freebsd || _openbsd) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
let cmd = 'netstat -tuna | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN\\|VERBUNDEN"';
|
||||
if (_freebsd || _openbsd) cmd = 'netstat -na | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN\\|VERBUNDEN"';
|
||||
if (_freebsd || _openbsd || _netbsd) cmd = 'netstat -na | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN\\|VERBUNDEN"';
|
||||
exec(cmd, { maxBuffer: 1024 * 2000 }, function (error, stdout) {
|
||||
if (!error) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
|
||||
+3
-2
@@ -25,6 +25,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
const NOT_SUPPORTED = 'not supported';
|
||||
@@ -220,7 +221,7 @@ function osInfo(callback) {
|
||||
//}
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
|
||||
exec('sysctl kern.ostype kern.osrelease kern.osrevision kern.hostuuid', function (error, stdout) {
|
||||
if (!error) {
|
||||
@@ -680,7 +681,7 @@ function uuid(callback) {
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
exec('kenv -q smbios.system.uuid', function (error, stdout) {
|
||||
if (!error) {
|
||||
result.os = stdout.toString().split('\n')[0].trim().toLowerCase();
|
||||
|
||||
+5
-4
@@ -26,6 +26,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
let _processes_cpu = {
|
||||
@@ -101,8 +102,8 @@ function services(srv, callback) {
|
||||
let dataSrv = [];
|
||||
let allSrv = [];
|
||||
|
||||
if (_linux || _freebsd || _openbsd || _darwin) {
|
||||
if ((_linux || _freebsd || _openbsd) && srv === '*') {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
|
||||
if ((_linux || _freebsd || _openbsd || _netbsd) && srv === '*') {
|
||||
srv = '';
|
||||
let tmpsrv = execSync('service --status-all 2> /dev/null').toString().split('\n');
|
||||
for (const s of tmpsrv) {
|
||||
@@ -560,9 +561,9 @@ function processes(callback) {
|
||||
let cmd = '';
|
||||
|
||||
if ((_processes_cpu.ms && Date.now() - _processes_cpu.ms >= 500) || _processes_cpu.ms === 0) {
|
||||
if (_linux || _freebsd || _openbsd || _darwin || _sunos) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd || _darwin || _sunos) {
|
||||
if (_linux) cmd = 'export LC_ALL=C; ps -axo pid:11,ppid:11,pcpu:6,pmem:6,pri:5,vsz:11,rss:11,ni:5,lstart:30,state:5,tty:15,user:20,command; unset LC_ALL';
|
||||
if (_freebsd || _openbsd) cmd = 'export LC_ALL=C; ps -axo pid,ppid,pcpu,pmem,pri,vsz,rss,ni,lstart,state,tty,user,command; unset LC_ALL';
|
||||
if (_freebsd || _openbsd || _netbsd) cmd = 'export LC_ALL=C; ps -axo pid,ppid,pcpu,pmem,pri,vsz,rss,ni,lstart,state,tty,user,command; unset LC_ALL';
|
||||
if (_darwin) cmd = 'export LC_ALL=C; ps -acxo pid,ppid,pcpu,pmem,pri,vsz,rss,nice,lstart,state,tty,user,command -r; unset LC_ALL';
|
||||
if (_sunos) cmd = 'ps -Ao pid,ppid,pcpu,pmem,pri,vsz,rss,nice,stime,s,tty,user,comm';
|
||||
exec(cmd, { maxBuffer: 1024 * 2000 }, function (error, stdout) {
|
||||
|
||||
+5
-4
@@ -25,6 +25,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
function system(callback) {
|
||||
@@ -41,7 +42,7 @@ function system(callback) {
|
||||
sku: '-',
|
||||
};
|
||||
|
||||
if (_linux || _freebsd || _openbsd) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
exec('export LC_ALL=C; dmidecode -t system 2>/dev/null; unset LC_ALL', function (error, stdout) {
|
||||
// if (!error) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
@@ -251,7 +252,7 @@ function bios(callback) {
|
||||
revision: '',
|
||||
};
|
||||
let cmd = '';
|
||||
if (_linux || _freebsd || _openbsd) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
if (process.arch === 'arm') {
|
||||
cmd = 'cat /proc/cpuinfo | grep Serial';
|
||||
|
||||
@@ -345,7 +346,7 @@ function baseboard(callback) {
|
||||
assetTag: '-',
|
||||
};
|
||||
let cmd = '';
|
||||
if (_linux || _freebsd || _openbsd) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
if (process.arch === 'arm') {
|
||||
cmd = 'cat /proc/cpuinfo | grep Serial';
|
||||
// 'BCM2709', 'BCM2835', 'BCM2708' -->
|
||||
@@ -485,7 +486,7 @@ function chassis(callback) {
|
||||
assetTag: '-',
|
||||
sku: '',
|
||||
};
|
||||
if (_linux || _freebsd || _openbsd) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
const cmd = `echo -n "chassis_asset_tag: "; cat /sys/devices/virtual/dmi/id/chassis_asset_tag 2>/dev/null; echo;
|
||||
echo -n "chassis_serial: "; cat /sys/devices/virtual/dmi/id/chassis_serial 2>/dev/null; echo;
|
||||
echo -n "chassis_type: "; cat /sys/devices/virtual/dmi/id/chassis_type 2>/dev/null; echo;
|
||||
|
||||
+2
-1
@@ -23,6 +23,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
// --------------------------
|
||||
@@ -211,7 +212,7 @@ function users(callback) {
|
||||
}
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
exec('who; echo "---"; w -ih', function (error, stdout) {
|
||||
if (!error) {
|
||||
// lines / split
|
||||
|
||||
+2
-1
@@ -25,6 +25,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
// const _sunos = (_platform === 'sunos');
|
||||
|
||||
let _cores = 0;
|
||||
@@ -320,7 +321,7 @@ function getCodepage() {
|
||||
}
|
||||
return codepage;
|
||||
}
|
||||
if (_linux || _darwin || _freebsd || _openbsd) {
|
||||
if (_linux || _darwin || _freebsd || _openbsd || _netbsd) {
|
||||
if (!codepage) {
|
||||
try {
|
||||
const stdout = execSync('echo $LANG');
|
||||
|
||||
Reference in New Issue
Block a user