added osInfo serial, build
This commit is contained in:
parent
f6b71f3406
commit
e601cc2910
@ -241,6 +241,8 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (
|
||||
| | arch | X | X | X | X | X | same as os.arch() |
|
||||
| | hostname | X | X | X | X | X | same as os.hostname() |
|
||||
| | logofile | X | X | X | X | X | e.g. 'apple', 'debian', 'fedora', ... |
|
||||
| | serial | | X | X | X | | OS/Host serial number |
|
||||
| | build | | | X | X | | OS build version |
|
||||
| si.versions(cb) | {...} | X | X | X | X | X | version information (kernel, ssl, node, ...) |
|
||||
| si.shell(cb) | : string | X | X | X | | | standard shell |
|
||||
| si.users(cb) | [{...}] | X | X | X | X | X | array of users online |
|
||||
|
||||
@ -173,7 +173,9 @@ function osInfo(callback) {
|
||||
kernel: os.release(),
|
||||
arch: os.arch(),
|
||||
hostname: os.hostname(),
|
||||
logofile: ''
|
||||
logofile: '',
|
||||
serial: '',
|
||||
build: ''
|
||||
};
|
||||
|
||||
if (_linux) {
|
||||
@ -208,12 +210,13 @@ function osInfo(callback) {
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
|
||||
exec('sysctl kern.ostype kern.osrelease kern.osrevision', function (error, stdout) {
|
||||
exec('sysctl kern.ostype kern.osrelease kern.osrevision kern.hostuuid', function (error, stdout) {
|
||||
if (!error) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
result.distro = util.getValue(lines, 'kern.ostype');
|
||||
result.logofile = getLogoFile(result.distro);
|
||||
result.release = util.getValue(lines, 'kern.osrelease').split('-')[0];
|
||||
result.serial = util.getValue(lines, 'kern.uuid');
|
||||
result.codename = '';
|
||||
}
|
||||
if (callback) {
|
||||
@ -223,15 +226,13 @@ function osInfo(callback) {
|
||||
});
|
||||
}
|
||||
if (_darwin) {
|
||||
exec('sw_vers', function (error, stdout) {
|
||||
exec('sw_vers; sysctl kern.ostype kern.osrelease kern.osrevision kern.uuid', function (error, stdout) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
lines.forEach(function (line) {
|
||||
if (line.indexOf('ProductName') !== -1) {
|
||||
result.distro = line.split(':')[1].trim();
|
||||
result.logofile = getLogoFile(result.distro);
|
||||
}
|
||||
if (line.indexOf('ProductVersion') !== -1) result.release = line.split(':')[1].trim();
|
||||
});
|
||||
result.serial = util.getValue(lines, 'kern.uuid');
|
||||
result.distro = util.getValue(lines, 'ProductName');
|
||||
result.release = util.getValue(lines, 'ProductVersion');
|
||||
result.build = util.getValue(lines, 'BuildVersion');
|
||||
result.logofile = getLogoFile(result.distro);
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
@ -252,8 +253,11 @@ function osInfo(callback) {
|
||||
result.logofile = getLogoFile();
|
||||
result.release = result.kernel;
|
||||
try {
|
||||
exec(util.getWmic() + ' os get Caption', opts, function (error, stdout) {
|
||||
result.distro = result.codename = stdout.slice(stdout.indexOf('\r\n') + 2).trim();
|
||||
exec(util.getWmic() + ' os get /value', opts, function (error, stdout) {
|
||||
let lines = stdout.toString().split('\r\n');
|
||||
result.distro = util.getValue(lines, 'Caption', '=').trim();
|
||||
result.serial = util.getValue(lines, 'SerialNumber', '=').trim();
|
||||
result.build = util.getValue(lines, 'BuildNumber', '=').trim();
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user