fsSize() adapted parsing linux
This commit is contained in:
parent
445dcfa60f
commit
db0e4ad7c5
@ -49,12 +49,17 @@ function fsSize(callback) {
|
|||||||
return 'HFS';
|
return 'HFS';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isLinuxTmpFs(fs) {
|
||||||
|
const linuxTmpFileSystems = ['rootfs', 'unionfs', 'squashfs', 'cramfs', 'initrd', 'initramfs', 'devtmpfs', 'tmpfs', 'udev', 'devfs', 'specfs'];
|
||||||
|
return (linuxTmpFileSystems.includes(fs.toLowerCase()));
|
||||||
|
}
|
||||||
|
|
||||||
function parseDf(lines) {
|
function parseDf(lines) {
|
||||||
let data = [];
|
let data = [];
|
||||||
lines.forEach(function (line) {
|
lines.forEach(function (line) {
|
||||||
if (line !== '') {
|
if (line !== '') {
|
||||||
line = line.replace(/ +/g, ' ').split(' ');
|
line = line.replace(/ +/g, ' ').split(' ');
|
||||||
if (line && ((line[0].startsWith('/')) || (line[6] && line[6] === '/') || (line[0].indexOf('/') > 0) || (line[0].indexOf(':') === 1))) {
|
if (line && ((line[0].startsWith('/')) || (line[6] && line[6] === '/') || (line[0].indexOf('/') > 0) || (line[0].indexOf(':') === 1) || !_darwin && !isLinuxTmpFs(line[1]))) {
|
||||||
const fs = line[0];
|
const fs = line[0];
|
||||||
const fsType = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : getmacOsFsType(line[0]));
|
const fsType = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : getmacOsFsType(line[0]));
|
||||||
const size = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])) * 1024;
|
const size = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])) * 1024;
|
||||||
@ -96,7 +101,7 @@ function fsSize(callback) {
|
|||||||
macOsDisks = [];
|
macOsDisks = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_linux) { cmd = 'df -lkPTx squashfs | grep -E "^/|^.\\:"'; }
|
if (_linux) { cmd = 'df -lkPTx squashfs'; } // cmd = 'df -lkPTx squashfs | grep -E "^/|^.\\:"';
|
||||||
if (_freebsd || _openbsd || _netbsd) { cmd = 'df -lkPT'; }
|
if (_freebsd || _openbsd || _netbsd) { cmd = 'df -lkPT'; }
|
||||||
exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) {
|
exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user