system() fix Raspberry Pi detection

This commit is contained in:
Sebastian Hildebrandt 2018-10-22 18:44:32 +02:00
parent dce83716c0
commit 880c5b5f30
2 changed files with 12 additions and 11 deletions

View File

@ -100,6 +100,7 @@ Other changes
| Version | Date | Comment | | Version | Date | Comment |
| -------------- | -------------- | -------- | | -------------- | -------------- | -------- |
| 3.45.8 | 2018-10-22 | `system()` fix Raspberry Pi detection |
| 3.45.7 | 2018-10-05 | fixed typos | | 3.45.7 | 2018-10-05 | fixed typos |
| 3.45.6 | 2018-09-12 | `mem()` bug parsing linux in other languages | | 3.45.6 | 2018-09-12 | `mem()` bug parsing linux in other languages |
| 3.45.5 | 2018-09-07 | `diskLayout()` tiny bug S.M.A.R.T status windows | | 3.45.5 | 2018-09-07 | `diskLayout()` tiny bug S.M.A.R.T status windows |

View File

@ -56,7 +56,7 @@ function system(callback) {
if (result.serial.toLowerCase().indexOf('o.e.m.') !== -1) result.serial = '-'; if (result.serial.toLowerCase().indexOf('o.e.m.') !== -1) result.serial = '-';
if (result.manufacturer.toLowerCase().indexOf('o.e.m.') !== -1) result.manufacturer = ''; if (result.manufacturer.toLowerCase().indexOf('o.e.m.') !== -1) result.manufacturer = '';
if (result.model.toLowerCase().indexOf('o.e.m.') !== -1) result.model = 'Computer'; if (result.model.toLowerCase().indexOf('o.e.m.') !== -1) result.model = 'Computer';
if (result.version.toLowerCase().indexOf('o.e.m.') !== -1) result.version = '-'; if (result.version.toLowerCase().indexOf('o.e.m.') !== -1) result.version = '';
if (result.sku.toLowerCase().indexOf('o.e.m.') !== -1) result.sku = '-'; if (result.sku.toLowerCase().indexOf('o.e.m.') !== -1) result.sku = '-';
} }
// detect docker // detect docker
@ -71,7 +71,7 @@ function system(callback) {
if (lines.length > 0) result.model = 'Virtual machine'; if (lines.length > 0) result.model = 'Virtual machine';
} }
if (result.manufacturer === '' && result.model === 'Computer' && result.version === '-') { if (result.manufacturer === '' && result.model === 'Computer' && result.version === '') {
// Check Raspberry Pi // Check Raspberry Pi
exec('cat /proc/cpuinfo', function (error, stdout) { exec('cat /proc/cpuinfo', function (error, stdout) {
if (!error) { if (!error) {
@ -209,10 +209,10 @@ function system(callback) {
} }
if (callback) { callback(result); } if (callback) { callback(result); }
resolve(result); resolve(result);
}); });
} catch (e) { } catch (e) {
if (callback) { callback(result); } if (callback) { callback(result); }
resolve(result); resolve(result);
} }
} }
}); });
@ -289,13 +289,13 @@ function bios(callback) {
} }
result.revision = util.getValue(lines, 'buildnumber', '='); result.revision = util.getValue(lines, 'buildnumber', '=');
} }
if (callback) { callback(result); } if (callback) { callback(result); }
resolve(result); resolve(result);
}); });
} catch (e) { } catch (e) {
if (callback) { callback(result); } if (callback) { callback(result); }
resolve(result); resolve(result);
} }
} }
}); });
@ -364,7 +364,7 @@ function baseboard(callback) {
exec(util.getWmic() + ' baseboard get /value', opts, function (error, stdout) { exec(util.getWmic() + ' baseboard get /value', opts, function (error, stdout) {
if (!error) { if (!error) {
let lines = stdout.toString().split('\r\n'); let lines = stdout.toString().split('\r\n');
result.manufacturer = util.getValue(lines, 'manufacturer', '='); result.manufacturer = util.getValue(lines, 'manufacturer', '=');
result.model = util.getValue(lines, 'model', '='); result.model = util.getValue(lines, 'model', '=');
if (!result.model) { if (!result.model) {
@ -377,13 +377,13 @@ function baseboard(callback) {
result.assetTag = util.getValue(lines, 'sku', '='); result.assetTag = util.getValue(lines, 'sku', '=');
} }
} }
if (callback) { callback(result); } if (callback) { callback(result); }
resolve(result); resolve(result);
}); });
} catch (e) { } catch (e) {
if (callback) { callback(result); } if (callback) { callback(result); }
resolve(result); resolve(result);
} }
} }
}); });