system() added model freebsd
This commit is contained in:
parent
07b822d2d7
commit
6f0c56c4c1
@ -16,6 +16,7 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const util = require('./util');
|
const util = require('./util');
|
||||||
|
const { uuid } = require('./osinfo');
|
||||||
const exec = require('child_process').exec;
|
const exec = require('child_process').exec;
|
||||||
const execSync = require('child_process').execSync;
|
const execSync = require('child_process').execSync;
|
||||||
const execPromise = util.promisify(require('child_process').exec);
|
const execPromise = util.promisify(require('child_process').exec);
|
||||||
@ -120,13 +121,18 @@ function system(callback) {
|
|||||||
util.noop();
|
util.noop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!result.uuid && (_freebsd || _openbsd || _netbsd)) {
|
if (_freebsd || _openbsd || _netbsd) {
|
||||||
try {
|
try {
|
||||||
const lines = execSync('sysctl -i kern.hostuuid kern.hostid', util.execOptsLinux).toString().split('\n');
|
const lines = execSync('sysctl -i kern.hostuuid kern.hostid hw.model', util.execOptsLinux).toString().split('\n');
|
||||||
result.uuid = util.getValue(lines, 'kern.hostuuid', ':').toLowerCase();
|
if (!result.uuid) {
|
||||||
|
result.uuid = util.getValue(lines, 'kern.hostuuid', ':').toLowerCase();
|
||||||
|
}
|
||||||
if (!result.serial || result.serial === '-') {
|
if (!result.serial || result.serial === '-') {
|
||||||
result.serial = util.getValue(lines, 'kern.hostid', ':').toLowerCase();
|
result.serial = util.getValue(lines, 'kern.hostid', ':').toLowerCase();
|
||||||
}
|
}
|
||||||
|
if (!result.model || result.model === 'Computer') {
|
||||||
|
result.model = util.getValue(lines, 'hw.model', ':').trim();
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
util.noop();
|
util.noop();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user