improved UEFI detection linux

This commit is contained in:
Sebastian Hildebrandt 2021-01-20 12:26:02 +01:00
parent 44744b77cd
commit cfd811bc62
2 changed files with 14 additions and 2 deletions

View File

@ -172,6 +172,7 @@ function fsOpenFiles(callback) {
let lines = stdout.toString().split('\n'); let lines = stdout.toString().split('\n');
result.max = parseInt(util.getValue(lines, 'kern.maxfiles', ':'), 10); result.max = parseInt(util.getValue(lines, 'kern.maxfiles', ':'), 10);
result.allocated = parseInt(util.getValue(lines, 'kern.num_files', ':'), 10); result.allocated = parseInt(util.getValue(lines, 'kern.num_files', ':'), 10);
result.available = result.max - result.allocated;
} }
if (callback) { if (callback) {
callback(result); callback(result);
@ -401,12 +402,17 @@ function blockDevices(callback) {
} }
resolve(data); resolve(data);
}); });
} catch (e) { } catch (e) {
if (callback) { callback(data); } if (callback) { callback(data); }
resolve(data); resolve(data);
} }
} }
if (_freebsd || _openbsd || _netbsd) {
// will follow
if (callback) { callback(null); }
resolve(null);
}
}); });
}); });
} }

View File

@ -353,7 +353,13 @@ function isUefiLinux() {
if (!err) { if (!err) {
resolve(true); resolve(true);
} else { } else {
resolve(false); exec('dmesg | grep -E "EFI v|UEFI"', function (error, stdout) {
if (!error) {
const lines = stdout.toString().split('\n');
return (lines.length > 0);
}
resolve(false);
});
} }
}); });
}); });