osInfo() added OS code name (windows)
This commit is contained in:
parent
95ed380879
commit
d2acfba582
19
.github/workflows/release.yml
vendored
Normal file
19
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Create GitHub Release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
generate_release_notes: true
|
||||||
|
|
||||||
@ -90,6 +90,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
|
|||||||
|
|
||||||
| Version | Date | Comment |
|
| Version | Date | Comment |
|
||||||
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
|
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
|
||||||
|
| 5.29.0 | 2026-01-04 | `osInfo()` added OS code name (windows) |
|
||||||
| 5.28.10 | 2026-01-03 | `graphics()` fix logging nvidia-smi error (windows) |
|
| 5.28.10 | 2026-01-03 | `graphics()` fix logging nvidia-smi error (windows) |
|
||||||
| 5.28.9 | 2026-01-02 | `fsSize()` fix df parsing missing mount points (linux) |
|
| 5.28.9 | 2026-01-02 | `fsSize()` fix df parsing missing mount points (linux) |
|
||||||
| 5.28.8 | 2026-01-01 | `bluetooth()` `battery()` improved enumeration (windows) |
|
| 5.28.8 | 2026-01-01 | `bluetooth()` `battery()` improved enumeration (windows) |
|
||||||
|
|||||||
@ -185,6 +185,7 @@ si.cpu()
|
|||||||
|
|
||||||
(last 7 major and minor version releases)
|
(last 7 major and minor version releases)
|
||||||
|
|
||||||
|
- Version 5.29.0: `osInfo()` added OS code name (windows)
|
||||||
- Version 5.28.0: `cpuTemperature()` added suppurt for macos-temperature-sensor (macOS)
|
- Version 5.28.0: `cpuTemperature()` added suppurt for macos-temperature-sensor (macOS)
|
||||||
- Version 5.27.0: `mem()` added reclaimable memory
|
- Version 5.27.0: `mem()` added reclaimable memory
|
||||||
- Version 5.26.0: `getStatic()`, `getAll()` added usb, audio, bluetooth, printer
|
- Version 5.26.0: `getStatic()`, `getAll()` added usb, audio, bluetooth, printer
|
||||||
@ -453,7 +454,7 @@ Full function reference with examples can be found at
|
|||||||
| | platform | X | X | X | X | X | 'linux', 'darwin', 'Windows', ... |
|
| | platform | X | X | X | X | X | 'linux', 'darwin', 'Windows', ... |
|
||||||
| | distro | X | X | X | X | X | |
|
| | distro | X | X | X | X | X | |
|
||||||
| | release | X | X | X | X | X | |
|
| | release | X | X | X | X | X | |
|
||||||
| | codename | X | | X | | | |
|
| | codename | X | | X | X | | |
|
||||||
| | kernel | X | X | X | X | X | kernel release - same as os.release() |
|
| | kernel | X | X | X | X | X | kernel release - same as os.release() |
|
||||||
| | arch | X | X | X | X | X | same as os.arch() |
|
| | arch | X | X | X | X | X | same as os.arch() |
|
||||||
| | hostname | X | X | X | X | X | same as os.hostname() |
|
| | hostname | X | X | X | X | X | same as os.hostname() |
|
||||||
|
|||||||
@ -57,6 +57,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">5.29.0</th>
|
||||||
|
<td>2026-01-04</td>
|
||||||
|
<td><span class="code">osInfo()</span> added OS code name (windows)</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">5.28.10</th>
|
<th scope="row">5.28.10</th>
|
||||||
<td>2026-01-03</td>
|
<td>2026-01-03</td>
|
||||||
|
|||||||
@ -170,7 +170,7 @@
|
|||||||
<img class="logo" src="assets/logo.png" alt="logo">
|
<img class="logo" src="assets/logo.png" alt="logo">
|
||||||
<div class="title">systeminformation</div>
|
<div class="title">systeminformation</div>
|
||||||
<div class="subtitle"><span id="typed"></span> </div>
|
<div class="subtitle"><span id="typed"></span> </div>
|
||||||
<div class="version">New Version: <span id="version">5.28.10</span></div>
|
<div class="version">New Version: <span id="version">5.29.0</span></div>
|
||||||
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
|
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="down">
|
<div class="down">
|
||||||
|
|||||||
@ -112,7 +112,7 @@
|
|||||||
<td>X</td>
|
<td>X</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>X</td>
|
<td>X</td>
|
||||||
<td></td>
|
<td>X</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
185
lib/osinfo.js
185
lib/osinfo.js
@ -19,7 +19,7 @@ const util = require('./util');
|
|||||||
const exec = require('child_process').exec;
|
const exec = require('child_process').exec;
|
||||||
const execSync = require('child_process').execSync;
|
const execSync = require('child_process').execSync;
|
||||||
|
|
||||||
let _platform = process.platform;
|
const _platform = process.platform;
|
||||||
|
|
||||||
const _linux = _platform === 'linux' || _platform === 'android';
|
const _linux = _platform === 'linux' || _platform === 'android';
|
||||||
const _darwin = _platform === 'darwin';
|
const _darwin = _platform === 'darwin';
|
||||||
@ -33,7 +33,7 @@ const _sunos = _platform === 'sunos';
|
|||||||
// Get current time and OS uptime
|
// Get current time and OS uptime
|
||||||
|
|
||||||
function time() {
|
function time() {
|
||||||
let t = new Date().toString().split(' ');
|
const t = new Date().toString().split(' ');
|
||||||
let timezoneName = '';
|
let timezoneName = '';
|
||||||
try {
|
try {
|
||||||
timezoneName = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
timezoneName = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||||
@ -63,7 +63,7 @@ function time() {
|
|||||||
timezone: lines[1] ? timezone + lines[1] : timezone,
|
timezone: lines[1] ? timezone + lines[1] : timezone,
|
||||||
timezoneName: lines[2] && lines[2].indexOf('/zoneinfo/') > 0 ? lines[2].split('/zoneinfo/')[1] || '' : ''
|
timezoneName: lines[2] && lines[2].indexOf('/zoneinfo/') > 0 ? lines[2].split('/zoneinfo/')[1] || '' : ''
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch {
|
||||||
util.noop();
|
util.noop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,6 +161,30 @@ function getLogoFile(distro) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const WINDOWS_RELEASES = [
|
||||||
|
[26200, '25H2'],
|
||||||
|
[26100, '24H2'],
|
||||||
|
[22631, '23H2'],
|
||||||
|
[22621, '22H2'],
|
||||||
|
[19045, '22H2'],
|
||||||
|
[22000, '21H2'],
|
||||||
|
[19044, '21H2'],
|
||||||
|
[19043, '21H1'],
|
||||||
|
[19042, '20H2'],
|
||||||
|
[19041, '2004'],
|
||||||
|
[18363, '1909'],
|
||||||
|
[18362, '1903'],
|
||||||
|
[17763, '1809'],
|
||||||
|
[17134, '1803']
|
||||||
|
];
|
||||||
|
|
||||||
|
function getWindowsRelease(build) {
|
||||||
|
for (const [minBuild, label] of WINDOWS_RELEASES) {
|
||||||
|
if (build >= minBuild) return label;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
// --------------------------
|
// --------------------------
|
||||||
// FQDN
|
// FQDN
|
||||||
|
|
||||||
@ -170,7 +194,7 @@ function getFQDN() {
|
|||||||
try {
|
try {
|
||||||
const stdout = execSync('hostname -f 2>/dev/null', util.execOptsLinux);
|
const stdout = execSync('hostname -f 2>/dev/null', util.execOptsLinux);
|
||||||
fqdn = stdout.toString().split(os.EOL)[0];
|
fqdn = stdout.toString().split(os.EOL)[0];
|
||||||
} catch (e) {
|
} catch {
|
||||||
util.noop();
|
util.noop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,7 +202,7 @@ function getFQDN() {
|
|||||||
try {
|
try {
|
||||||
const stdout = execSync('hostname 2>/dev/null');
|
const stdout = execSync('hostname 2>/dev/null');
|
||||||
fqdn = stdout.toString().split(os.EOL)[0];
|
fqdn = stdout.toString().split(os.EOL)[0];
|
||||||
} catch (e) {
|
} catch {
|
||||||
util.noop();
|
util.noop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,7 +210,7 @@ function getFQDN() {
|
|||||||
try {
|
try {
|
||||||
const stdout = execSync('echo %COMPUTERNAME%.%USERDNSDOMAIN%', util.execOptsWin);
|
const stdout = execSync('echo %COMPUTERNAME%.%USERDNSDOMAIN%', util.execOptsWin);
|
||||||
fqdn = stdout.toString().replace('.%USERDNSDOMAIN%', '').split(os.EOL)[0];
|
fqdn = stdout.toString().replace('.%USERDNSDOMAIN%', '').split(os.EOL)[0];
|
||||||
} catch (e) {
|
} catch {
|
||||||
util.noop();
|
util.noop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,7 +241,7 @@ function osInfo(callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (_linux) {
|
if (_linux) {
|
||||||
exec('cat /etc/*-release; cat /usr/lib/os-release; cat /etc/openwrt_release', function (error, stdout) {
|
exec('cat /etc/*-release; cat /usr/lib/os-release; cat /etc/openwrt_release', (error, stdout) => {
|
||||||
/**
|
/**
|
||||||
* @namespace
|
* @namespace
|
||||||
* @property {string} DISTRIB_ID
|
* @property {string} DISTRIB_ID
|
||||||
@ -228,7 +252,7 @@ function osInfo(callback) {
|
|||||||
*/
|
*/
|
||||||
let release = {};
|
let release = {};
|
||||||
let lines = stdout.toString().split('\n');
|
let lines = stdout.toString().split('\n');
|
||||||
lines.forEach(function (line) {
|
lines.forEach((line) => {
|
||||||
if (line.indexOf('=') !== -1) {
|
if (line.indexOf('=') !== -1) {
|
||||||
release[line.split('=')[0].trim().toUpperCase()] = line.split('=')[1].trim();
|
release[line.split('=')[0].trim().toUpperCase()] = line.split('=')[1].trim();
|
||||||
}
|
}
|
||||||
@ -262,7 +286,7 @@ function osInfo(callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (_freebsd || _openbsd || _netbsd) {
|
if (_freebsd || _openbsd || _netbsd) {
|
||||||
exec('sysctl kern.ostype kern.osrelease kern.osrevision kern.hostuuid machdep.bootmethod kern.geom.confxml', function (error, stdout) {
|
exec('sysctl kern.ostype kern.osrelease kern.osrevision kern.hostuuid machdep.bootmethod kern.geom.confxml', (error, stdout) => {
|
||||||
let lines = stdout.toString().split('\n');
|
let lines = stdout.toString().split('\n');
|
||||||
const distro = util.getValue(lines, 'kern.ostype');
|
const distro = util.getValue(lines, 'kern.ostype');
|
||||||
const logofile = getLogoFile(distro);
|
const logofile = getLogoFile(distro);
|
||||||
@ -285,7 +309,7 @@ function osInfo(callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (_darwin) {
|
if (_darwin) {
|
||||||
exec('sw_vers; sysctl kern.ostype kern.osrelease kern.osrevision kern.uuid', function (error, stdout) {
|
exec('sw_vers; sysctl kern.ostype kern.osrelease kern.osrevision kern.uuid', (error, stdout) => {
|
||||||
let lines = stdout.toString().split('\n');
|
let lines = stdout.toString().split('\n');
|
||||||
result.serial = util.getValue(lines, 'kern.uuid');
|
result.serial = util.getValue(lines, 'kern.uuid');
|
||||||
result.distro = util.getValue(lines, 'ProductName');
|
result.distro = util.getValue(lines, 'ProductName');
|
||||||
@ -321,8 +345,8 @@ function osInfo(callback) {
|
|||||||
}
|
}
|
||||||
if (_sunos) {
|
if (_sunos) {
|
||||||
result.release = result.kernel;
|
result.release = result.kernel;
|
||||||
exec('uname -o', function (error, stdout) {
|
exec('uname -o', (error, stdout) => {
|
||||||
let lines = stdout.toString().split('\n');
|
const lines = stdout.toString().split('\n');
|
||||||
result.distro = lines[0];
|
result.distro = lines[0];
|
||||||
result.logofile = getLogoFile(result.distro);
|
result.logofile = getLogoFile(result.distro);
|
||||||
if (callback) {
|
if (callback) {
|
||||||
@ -339,8 +363,9 @@ function osInfo(callback) {
|
|||||||
workload.push(util.powerShell('Get-CimInstance Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion | fl'));
|
workload.push(util.powerShell('Get-CimInstance Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion | fl'));
|
||||||
workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
|
workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
|
||||||
workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession'));
|
workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession'));
|
||||||
|
workload.push(util.powerShell('reg query "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" /v DisplayVersion'));
|
||||||
util.promiseAll(workload).then((data) => {
|
util.promiseAll(workload).then((data) => {
|
||||||
let lines = data.results[0] ? data.results[0].toString().split('\r\n') : [''];
|
const lines = data.results[0] ? data.results[0].toString().split('\r\n') : [''];
|
||||||
result.distro = util.getValue(lines, 'Caption', ':').trim();
|
result.distro = util.getValue(lines, 'Caption', ':').trim();
|
||||||
result.serial = util.getValue(lines, 'SerialNumber', ':').trim();
|
result.serial = util.getValue(lines, 'SerialNumber', ':').trim();
|
||||||
result.build = util.getValue(lines, 'BuildNumber', ':').trim();
|
result.build = util.getValue(lines, 'BuildNumber', ':').trim();
|
||||||
@ -349,6 +374,14 @@ function osInfo(callback) {
|
|||||||
const hyperv = data.results[1] ? data.results[1].toString().toLowerCase() : '';
|
const hyperv = data.results[1] ? data.results[1].toString().toLowerCase() : '';
|
||||||
result.hypervisor = hyperv.indexOf('true') !== -1;
|
result.hypervisor = hyperv.indexOf('true') !== -1;
|
||||||
const term = data.results[2] ? data.results[2].toString() : '';
|
const term = data.results[2] ? data.results[2].toString() : '';
|
||||||
|
if (data.results[3]) {
|
||||||
|
const codenameParts = data.results[3].split('REG_SZ');
|
||||||
|
result.codename = codenameParts.length > 1 ? codenameParts[1].trim() : '';
|
||||||
|
}
|
||||||
|
if (!result.codename) {
|
||||||
|
const buildNum = parseInt(result.build, 10);
|
||||||
|
result.codename = getWindowsRelease(buildNum);
|
||||||
|
}
|
||||||
result.remoteSession = term.toString().toLowerCase().indexOf('true') >= 0;
|
result.remoteSession = term.toString().toLowerCase().indexOf('true') >= 0;
|
||||||
isUefiWindows().then((uefi) => {
|
isUefiWindows().then((uefi) => {
|
||||||
result.uefi = uefi;
|
result.uefi = uefi;
|
||||||
@ -358,7 +391,7 @@ function osInfo(callback) {
|
|||||||
resolve(result);
|
resolve(result);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(result);
|
callback(result);
|
||||||
}
|
}
|
||||||
@ -374,11 +407,11 @@ exports.osInfo = osInfo;
|
|||||||
function isUefiLinux() {
|
function isUefiLinux() {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
fs.stat('/sys/firmware/efi', function (err) {
|
fs.stat('/sys/firmware/efi', (err) => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
return resolve(true);
|
return resolve(true);
|
||||||
} else {
|
} else {
|
||||||
exec('dmesg | grep -E "EFI v"', function (error, stdout) {
|
exec('dmesg | grep -E "EFI v"', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const lines = stdout.toString().split('\n');
|
const lines = stdout.toString().split('\n');
|
||||||
return resolve(lines.length > 0);
|
return resolve(lines.length > 0);
|
||||||
@ -395,12 +428,12 @@ function isUefiWindows() {
|
|||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
try {
|
try {
|
||||||
exec('findstr /C:"Detected boot environment" "%windir%\\Panther\\setupact.log"', util.execOptsWin, function (error, stdout) {
|
exec('findstr /C:"Detected boot environment" "%windir%\\Panther\\setupact.log"', util.execOptsWin, (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const line = stdout.toString().split('\n\r')[0];
|
const line = stdout.toString().split('\n\r')[0];
|
||||||
return resolve(line.toLowerCase().indexOf('efi') >= 0);
|
return resolve(line.toLowerCase().indexOf('efi') >= 0);
|
||||||
} else {
|
} else {
|
||||||
exec('echo %firmware_type%', util.execOptsWin, function (error, stdout) {
|
exec('echo %firmware_type%', util.execOptsWin, (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const line = stdout.toString() || '';
|
const line = stdout.toString() || '';
|
||||||
return resolve(line.toLowerCase().indexOf('efi') >= 0);
|
return resolve(line.toLowerCase().indexOf('efi') >= 0);
|
||||||
@ -410,7 +443,7 @@ function isUefiWindows() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch {
|
||||||
return resolve(false);
|
return resolve(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -513,8 +546,8 @@ function versions(apps, callback) {
|
|||||||
const appsObj = checkVersionParam(apps);
|
const appsObj = checkVersionParam(apps);
|
||||||
let totalFunctions = appsObj.counter;
|
let totalFunctions = appsObj.counter;
|
||||||
|
|
||||||
let functionProcessed = (function () {
|
let functionProcessed = (() => {
|
||||||
return function () {
|
return () => {
|
||||||
if (--totalFunctions === 0) {
|
if (--totalFunctions === 0) {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(appsObj.versions);
|
callback(appsObj.versions);
|
||||||
@ -528,7 +561,7 @@ function versions(apps, callback) {
|
|||||||
try {
|
try {
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'openssl')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'openssl')) {
|
||||||
appsObj.versions.openssl = process.versions.openssl;
|
appsObj.versions.openssl = process.versions.openssl;
|
||||||
exec('openssl version', function (error, stdout) {
|
exec('openssl version', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
let openssl_string = stdout.toString().split('\n')[0].trim();
|
let openssl_string = stdout.toString().split('\n')[0].trim();
|
||||||
let openssl = openssl_string.split(' ');
|
let openssl = openssl_string.split(' ');
|
||||||
@ -539,7 +572,7 @@ function versions(apps, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'npm')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'npm')) {
|
||||||
exec('npm -v', function (error, stdout) {
|
exec('npm -v', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
appsObj.versions.npm = stdout.toString().split('\n')[0];
|
appsObj.versions.npm = stdout.toString().split('\n')[0];
|
||||||
}
|
}
|
||||||
@ -551,7 +584,7 @@ function versions(apps, callback) {
|
|||||||
if (_windows) {
|
if (_windows) {
|
||||||
cmd += '.cmd';
|
cmd += '.cmd';
|
||||||
}
|
}
|
||||||
exec(`${cmd} -v`, function (error, stdout) {
|
exec(`${cmd} -v`, (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
let pm2 = stdout.toString().split('\n')[0].trim();
|
let pm2 = stdout.toString().split('\n')[0].trim();
|
||||||
if (!pm2.startsWith('[PM2]')) {
|
if (!pm2.startsWith('[PM2]')) {
|
||||||
@ -562,7 +595,7 @@ function versions(apps, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'yarn')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'yarn')) {
|
||||||
exec('yarn --version', function (error, stdout) {
|
exec('yarn --version', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
appsObj.versions.yarn = stdout.toString().split('\n')[0];
|
appsObj.versions.yarn = stdout.toString().split('\n')[0];
|
||||||
}
|
}
|
||||||
@ -574,7 +607,7 @@ function versions(apps, callback) {
|
|||||||
if (_windows) {
|
if (_windows) {
|
||||||
cmd += '.cmd';
|
cmd += '.cmd';
|
||||||
}
|
}
|
||||||
exec(`${cmd} --version`, function (error, stdout) {
|
exec(`${cmd} --version`, (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const gulp = stdout.toString().split('\n')[0] || '';
|
const gulp = stdout.toString().split('\n')[0] || '';
|
||||||
appsObj.versions.gulp = (gulp.toLowerCase().split('version')[1] || '').trim();
|
appsObj.versions.gulp = (gulp.toLowerCase().split('version')[1] || '').trim();
|
||||||
@ -584,7 +617,7 @@ function versions(apps, callback) {
|
|||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'homebrew')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'homebrew')) {
|
||||||
cmd = 'brew';
|
cmd = 'brew';
|
||||||
exec(`${cmd} --version`, function (error, stdout) {
|
exec(`${cmd} --version`, (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const brew = stdout.toString().split('\n')[0] || '';
|
const brew = stdout.toString().split('\n')[0] || '';
|
||||||
appsObj.versions.homebrew = (brew.toLowerCase().split(' ')[1] || '').trim();
|
appsObj.versions.homebrew = (brew.toLowerCase().split(' ')[1] || '').trim();
|
||||||
@ -597,7 +630,7 @@ function versions(apps, callback) {
|
|||||||
if (_windows) {
|
if (_windows) {
|
||||||
cmd += '.cmd';
|
cmd += '.cmd';
|
||||||
}
|
}
|
||||||
exec(`${cmd} --version`, function (error, stdout) {
|
exec(`${cmd} --version`, (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const tsc = stdout.toString().split('\n')[0] || '';
|
const tsc = stdout.toString().split('\n')[0] || '';
|
||||||
appsObj.versions.tsc = (tsc.toLowerCase().split('version')[1] || '').trim();
|
appsObj.versions.tsc = (tsc.toLowerCase().split('version')[1] || '').trim();
|
||||||
@ -610,7 +643,7 @@ function versions(apps, callback) {
|
|||||||
if (_windows) {
|
if (_windows) {
|
||||||
cmd += '.cmd';
|
cmd += '.cmd';
|
||||||
}
|
}
|
||||||
exec(`${cmd} --version`, function (error, stdout) {
|
exec(`${cmd} --version`, (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const grunt = stdout.toString().split('\n')[0] || '';
|
const grunt = stdout.toString().split('\n')[0] || '';
|
||||||
appsObj.versions.grunt = (grunt.toLowerCase().split('cli v')[1] || '').trim();
|
appsObj.versions.grunt = (grunt.toLowerCase().split('cli v')[1] || '').trim();
|
||||||
@ -622,7 +655,7 @@ function versions(apps, callback) {
|
|||||||
if (_darwin) {
|
if (_darwin) {
|
||||||
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/git') || fs.existsSync('/opt/homebrew/bin/git');
|
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/git') || fs.existsSync('/opt/homebrew/bin/git');
|
||||||
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
||||||
exec('git --version', function (error, stdout) {
|
exec('git --version', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
let git = stdout.toString().split('\n')[0] || '';
|
let git = stdout.toString().split('\n')[0] || '';
|
||||||
git = (git.toLowerCase().split('version')[1] || '').trim();
|
git = (git.toLowerCase().split('version')[1] || '').trim();
|
||||||
@ -634,7 +667,7 @@ function versions(apps, callback) {
|
|||||||
functionProcessed();
|
functionProcessed();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
exec('git --version', function (error, stdout) {
|
exec('git --version', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
let git = stdout.toString().split('\n')[0] || '';
|
let git = stdout.toString().split('\n')[0] || '';
|
||||||
git = (git.toLowerCase().split('version')[1] || '').trim();
|
git = (git.toLowerCase().split('version')[1] || '').trim();
|
||||||
@ -645,7 +678,7 @@ function versions(apps, callback) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'apache')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'apache')) {
|
||||||
exec('apachectl -v 2>&1', function (error, stdout) {
|
exec('apachectl -v 2>&1', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const apache = (stdout.toString().split('\n')[0] || '').split(':');
|
const apache = (stdout.toString().split('\n')[0] || '').split(':');
|
||||||
appsObj.versions.apache = apache.length > 1 ? apache[1].replace('Apache', '').replace('/', '').split('(')[0].trim() : '';
|
appsObj.versions.apache = apache.length > 1 ? apache[1].replace('Apache', '').replace('/', '').split('(')[0].trim() : '';
|
||||||
@ -654,7 +687,7 @@ function versions(apps, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'nginx')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'nginx')) {
|
||||||
exec('nginx -v 2>&1', function (error, stdout) {
|
exec('nginx -v 2>&1', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const nginx = stdout.toString().split('\n')[0] || '';
|
const nginx = stdout.toString().split('\n')[0] || '';
|
||||||
appsObj.versions.nginx = (nginx.toLowerCase().split('/')[1] || '').trim();
|
appsObj.versions.nginx = (nginx.toLowerCase().split('/')[1] || '').trim();
|
||||||
@ -663,7 +696,7 @@ function versions(apps, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'mysql')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'mysql')) {
|
||||||
exec('mysql -V', function (error, stdout) {
|
exec('mysql -V', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
let mysql = stdout.toString().split('\n')[0] || '';
|
let mysql = stdout.toString().split('\n')[0] || '';
|
||||||
mysql = mysql.toLowerCase();
|
mysql = mysql.toLowerCase();
|
||||||
@ -682,7 +715,7 @@ function versions(apps, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'php')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'php')) {
|
||||||
exec('php -v', function (error, stdout) {
|
exec('php -v', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const php = stdout.toString().split('\n')[0] || '';
|
const php = stdout.toString().split('\n')[0] || '';
|
||||||
let parts = php.split('(');
|
let parts = php.split('(');
|
||||||
@ -695,7 +728,7 @@ function versions(apps, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'redis')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'redis')) {
|
||||||
exec('redis-server --version', function (error, stdout) {
|
exec('redis-server --version', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const redis = stdout.toString().split('\n')[0] || '';
|
const redis = stdout.toString().split('\n')[0] || '';
|
||||||
const parts = redis.split(' ');
|
const parts = redis.split(' ');
|
||||||
@ -705,7 +738,7 @@ function versions(apps, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'docker')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'docker')) {
|
||||||
exec('docker --version', function (error, stdout) {
|
exec('docker --version', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const docker = stdout.toString().split('\n')[0] || '';
|
const docker = stdout.toString().split('\n')[0] || '';
|
||||||
const parts = docker.split(' ');
|
const parts = docker.split(' ');
|
||||||
@ -715,7 +748,7 @@ function versions(apps, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'postfix')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'postfix')) {
|
||||||
exec('postconf -d | grep mail_version', function (error, stdout) {
|
exec('postconf -d | grep mail_version', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const postfix = stdout.toString().split('\n') || [];
|
const postfix = stdout.toString().split('\n') || [];
|
||||||
appsObj.versions.postfix = util.getValue(postfix, 'mail_version', '=', true);
|
appsObj.versions.postfix = util.getValue(postfix, 'mail_version', '=', true);
|
||||||
@ -724,7 +757,7 @@ function versions(apps, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'mongodb')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'mongodb')) {
|
||||||
exec('mongod --version', function (error, stdout) {
|
exec('mongod --version', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const mongodb = stdout.toString().split('\n')[0] || '';
|
const mongodb = stdout.toString().split('\n')[0] || '';
|
||||||
appsObj.versions.mongodb = (mongodb.toLowerCase().split(',')[0] || '').replace(/[^0-9.]/g, '');
|
appsObj.versions.mongodb = (mongodb.toLowerCase().split(',')[0] || '').replace(/[^0-9.]/g, '');
|
||||||
@ -734,11 +767,11 @@ function versions(apps, callback) {
|
|||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'postgresql')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'postgresql')) {
|
||||||
if (_linux) {
|
if (_linux) {
|
||||||
exec('locate bin/postgres', function (error, stdout) {
|
exec('locate bin/postgres', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const postgresqlBin = stdout.toString().split('\n').sort();
|
const postgresqlBin = stdout.toString().split('\n').sort();
|
||||||
if (postgresqlBin.length) {
|
if (postgresqlBin.length) {
|
||||||
exec(postgresqlBin[postgresqlBin.length - 1] + ' -V', function (error, stdout) {
|
exec(postgresqlBin[postgresqlBin.length - 1] + ' -V', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
|
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
|
||||||
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
||||||
@ -749,7 +782,7 @@ function versions(apps, callback) {
|
|||||||
functionProcessed();
|
functionProcessed();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
exec('psql -V', function (error, stdout) {
|
exec('psql -V', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
|
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
|
||||||
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
||||||
@ -778,12 +811,12 @@ function versions(apps, callback) {
|
|||||||
functionProcessed();
|
functionProcessed();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
exec('postgres -V', function (error, stdout) {
|
exec('postgres -V', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
|
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
|
||||||
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
||||||
} else {
|
} else {
|
||||||
exec('pg_config --version', function (error, stdout) {
|
exec('pg_config --version', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
|
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
|
||||||
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
||||||
@ -796,7 +829,7 @@ function versions(apps, callback) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'perl')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'perl')) {
|
||||||
exec('perl -v', function (error, stdout) {
|
exec('perl -v', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const perl = stdout.toString().split('\n') || '';
|
const perl = stdout.toString().split('\n') || '';
|
||||||
while (perl.length > 0 && perl[0].trim() === '') {
|
while (perl.length > 0 && perl[0].trim() === '') {
|
||||||
@ -819,7 +852,7 @@ function versions(apps, callback) {
|
|||||||
const gitHomebrewExists2 = fs.existsSync('/opt/homebrew/bin/python');
|
const gitHomebrewExists2 = fs.existsSync('/opt/homebrew/bin/python');
|
||||||
if ((util.darwinXcodeExists() && util.semverCompare('12.0.1', osVersion) < 0) || gitHomebrewExists1 || gitHomebrewExists2) {
|
if ((util.darwinXcodeExists() && util.semverCompare('12.0.1', osVersion) < 0) || gitHomebrewExists1 || gitHomebrewExists2) {
|
||||||
const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' : gitHomebrewExists2 ? '/opt/homebrew/bin/python -V 2>&1' : 'python -V 2>&1';
|
const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' : gitHomebrewExists2 ? '/opt/homebrew/bin/python -V 2>&1' : 'python -V 2>&1';
|
||||||
exec(cmd, function (error, stdout) {
|
exec(cmd, (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const python = stdout.toString().split('\n')[0] || '';
|
const python = stdout.toString().split('\n')[0] || '';
|
||||||
appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
|
appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
|
||||||
@ -829,11 +862,11 @@ function versions(apps, callback) {
|
|||||||
} else {
|
} else {
|
||||||
functionProcessed();
|
functionProcessed();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch {
|
||||||
functionProcessed();
|
functionProcessed();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
exec('python -V 2>&1', function (error, stdout) {
|
exec('python -V 2>&1', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const python = stdout.toString().split('\n')[0] || '';
|
const python = stdout.toString().split('\n')[0] || '';
|
||||||
appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
|
appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
|
||||||
@ -846,7 +879,7 @@ function versions(apps, callback) {
|
|||||||
if (_darwin) {
|
if (_darwin) {
|
||||||
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/python3') || fs.existsSync('/opt/homebrew/bin/python3');
|
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/python3') || fs.existsSync('/opt/homebrew/bin/python3');
|
||||||
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
||||||
exec('python3 -V 2>&1', function (error, stdout) {
|
exec('python3 -V 2>&1', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const python = stdout.toString().split('\n')[0] || '';
|
const python = stdout.toString().split('\n')[0] || '';
|
||||||
appsObj.versions.python3 = python.toLowerCase().replace('python', '').trim();
|
appsObj.versions.python3 = python.toLowerCase().replace('python', '').trim();
|
||||||
@ -857,7 +890,7 @@ function versions(apps, callback) {
|
|||||||
functionProcessed();
|
functionProcessed();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
exec('python3 -V 2>&1', function (error, stdout) {
|
exec('python3 -V 2>&1', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const python = stdout.toString().split('\n')[0] || '';
|
const python = stdout.toString().split('\n')[0] || '';
|
||||||
appsObj.versions.python3 = python.toLowerCase().replace('python', '').trim();
|
appsObj.versions.python3 = python.toLowerCase().replace('python', '').trim();
|
||||||
@ -870,7 +903,7 @@ function versions(apps, callback) {
|
|||||||
if (_darwin) {
|
if (_darwin) {
|
||||||
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip') || fs.existsSync('/opt/homebrew/bin/pip');
|
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip') || fs.existsSync('/opt/homebrew/bin/pip');
|
||||||
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
||||||
exec('pip -V 2>&1', function (error, stdout) {
|
exec('pip -V 2>&1', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const pip = stdout.toString().split('\n')[0] || '';
|
const pip = stdout.toString().split('\n')[0] || '';
|
||||||
const parts = pip.split(' ');
|
const parts = pip.split(' ');
|
||||||
@ -882,7 +915,7 @@ function versions(apps, callback) {
|
|||||||
functionProcessed();
|
functionProcessed();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
exec('pip -V 2>&1', function (error, stdout) {
|
exec('pip -V 2>&1', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const pip = stdout.toString().split('\n')[0] || '';
|
const pip = stdout.toString().split('\n')[0] || '';
|
||||||
const parts = pip.split(' ');
|
const parts = pip.split(' ');
|
||||||
@ -896,7 +929,7 @@ function versions(apps, callback) {
|
|||||||
if (_darwin) {
|
if (_darwin) {
|
||||||
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip3') || fs.existsSync('/opt/homebrew/bin/pip3');
|
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip3') || fs.existsSync('/opt/homebrew/bin/pip3');
|
||||||
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
||||||
exec('pip3 -V 2>&1', function (error, stdout) {
|
exec('pip3 -V 2>&1', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const pip = stdout.toString().split('\n')[0] || '';
|
const pip = stdout.toString().split('\n')[0] || '';
|
||||||
const parts = pip.split(' ');
|
const parts = pip.split(' ');
|
||||||
@ -908,7 +941,7 @@ function versions(apps, callback) {
|
|||||||
functionProcessed();
|
functionProcessed();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
exec('pip3 -V 2>&1', function (error, stdout) {
|
exec('pip3 -V 2>&1', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const pip = stdout.toString().split('\n')[0] || '';
|
const pip = stdout.toString().split('\n')[0] || '';
|
||||||
const parts = pip.split(' ');
|
const parts = pip.split(' ');
|
||||||
@ -921,10 +954,10 @@ function versions(apps, callback) {
|
|||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'java')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'java')) {
|
||||||
if (_darwin) {
|
if (_darwin) {
|
||||||
// check if any JVM is installed but avoid dialog box that Java needs to be installed
|
// check if any JVM is installed but avoid dialog box that Java needs to be installed
|
||||||
exec('/usr/libexec/java_home -V 2>&1', function (error, stdout) {
|
exec('/usr/libexec/java_home -V 2>&1', (error, stdout) => {
|
||||||
if (!error && stdout.toString().toLowerCase().indexOf('no java runtime') === -1) {
|
if (!error && stdout.toString().toLowerCase().indexOf('no java runtime') === -1) {
|
||||||
// now this can be done savely
|
// now this can be done savely
|
||||||
exec('java -version 2>&1', function (error, stdout) {
|
exec('java -version 2>&1', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const java = stdout.toString().split('\n')[0] || '';
|
const java = stdout.toString().split('\n')[0] || '';
|
||||||
const parts = java.split('"');
|
const parts = java.split('"');
|
||||||
@ -937,7 +970,7 @@ function versions(apps, callback) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
exec('java -version 2>&1', function (error, stdout) {
|
exec('java -version 2>&1', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const java = stdout.toString().split('\n')[0] || '';
|
const java = stdout.toString().split('\n')[0] || '';
|
||||||
const parts = java.split('"');
|
const parts = java.split('"');
|
||||||
@ -949,14 +982,14 @@ function versions(apps, callback) {
|
|||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'gcc')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'gcc')) {
|
||||||
if ((_darwin && util.darwinXcodeExists()) || !_darwin) {
|
if ((_darwin && util.darwinXcodeExists()) || !_darwin) {
|
||||||
exec('gcc -dumpversion', function (error, stdout) {
|
exec('gcc -dumpversion', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
appsObj.versions.gcc = stdout.toString().split('\n')[0].trim() || '';
|
appsObj.versions.gcc = stdout.toString().split('\n')[0].trim() || '';
|
||||||
}
|
}
|
||||||
if (appsObj.versions.gcc.indexOf('.') > -1) {
|
if (appsObj.versions.gcc.indexOf('.') > -1) {
|
||||||
functionProcessed();
|
functionProcessed();
|
||||||
} else {
|
} else {
|
||||||
exec('gcc --version', function (error, stdout) {
|
exec('gcc --version', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const gcc = stdout.toString().split('\n')[0].trim();
|
const gcc = stdout.toString().split('\n')[0].trim();
|
||||||
if (gcc.indexOf('gcc') > -1 && gcc.indexOf(')') > -1) {
|
if (gcc.indexOf('gcc') > -1 && gcc.indexOf(')') > -1) {
|
||||||
@ -973,7 +1006,7 @@ function versions(apps, callback) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'virtualbox')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'virtualbox')) {
|
||||||
exec(util.getVboxmanage() + ' -v 2>&1', function (error, stdout) {
|
exec(util.getVboxmanage() + ' -v 2>&1', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const vbox = stdout.toString().split('\n')[0] || '';
|
const vbox = stdout.toString().split('\n')[0] || '';
|
||||||
const parts = vbox.split('r');
|
const parts = vbox.split('r');
|
||||||
@ -983,7 +1016,7 @@ function versions(apps, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'bash')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'bash')) {
|
||||||
exec('bash --version', function (error, stdout) {
|
exec('bash --version', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const line = stdout.toString().split('\n')[0];
|
const line = stdout.toString().split('\n')[0];
|
||||||
const parts = line.split(' version ');
|
const parts = line.split(' version ');
|
||||||
@ -995,7 +1028,7 @@ function versions(apps, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'zsh')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'zsh')) {
|
||||||
exec('zsh --version', function (error, stdout) {
|
exec('zsh --version', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const line = stdout.toString().split('\n')[0];
|
const line = stdout.toString().split('\n')[0];
|
||||||
const parts = line.split('zsh ');
|
const parts = line.split('zsh ');
|
||||||
@ -1007,7 +1040,7 @@ function versions(apps, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'fish')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'fish')) {
|
||||||
exec('fish --version', function (error, stdout) {
|
exec('fish --version', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const line = stdout.toString().split('\n')[0];
|
const line = stdout.toString().split('\n')[0];
|
||||||
const parts = line.split(' version ');
|
const parts = line.split(' version ');
|
||||||
@ -1019,7 +1052,7 @@ function versions(apps, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'bun')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'bun')) {
|
||||||
exec('bun -v', function (error, stdout) {
|
exec('bun -v', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const line = stdout.toString().split('\n')[0].trim();
|
const line = stdout.toString().split('\n')[0].trim();
|
||||||
appsObj.versions.bun = line;
|
appsObj.versions.bun = line;
|
||||||
@ -1028,7 +1061,7 @@ function versions(apps, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'deno')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'deno')) {
|
||||||
exec('deno -v', function (error, stdout) {
|
exec('deno -v', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const line = stdout.toString().split('\n')[0].trim();
|
const line = stdout.toString().split('\n')[0].trim();
|
||||||
const parts = line.split(' ');
|
const parts = line.split(' ');
|
||||||
@ -1040,7 +1073,7 @@ function versions(apps, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'node')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'node')) {
|
||||||
exec('node -v', function (error, stdout) {
|
exec('node -v', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
let line = stdout.toString().split('\n')[0].trim();
|
let line = stdout.toString().split('\n')[0].trim();
|
||||||
if (line.startsWith('v')) {
|
if (line.startsWith('v')) {
|
||||||
@ -1089,7 +1122,7 @@ function versions(apps, callback) {
|
|||||||
functionProcessed();
|
functionProcessed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(appsObj.versions);
|
callback(appsObj.versions);
|
||||||
}
|
}
|
||||||
@ -1127,7 +1160,7 @@ function shell(callback) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let result = '';
|
let result = '';
|
||||||
exec('echo $SHELL', function (error, stdout) {
|
exec('echo $SHELL', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
result = stdout.toString().split('\n')[0];
|
result = stdout.toString().split('\n')[0];
|
||||||
}
|
}
|
||||||
@ -1149,7 +1182,7 @@ function getUniqueMacAdresses() {
|
|||||||
const ifaces = os.networkInterfaces();
|
const ifaces = os.networkInterfaces();
|
||||||
for (let dev in ifaces) {
|
for (let dev in ifaces) {
|
||||||
if ({}.hasOwnProperty.call(ifaces, dev)) {
|
if ({}.hasOwnProperty.call(ifaces, dev)) {
|
||||||
ifaces[dev].forEach(function (details) {
|
ifaces[dev].forEach((details) => {
|
||||||
if (details && details.mac && details.mac !== '00:00:00:00:00:00') {
|
if (details && details.mac && details.mac !== '00:00:00:00:00:00') {
|
||||||
const mac = details.mac.toLowerCase();
|
const mac = details.mac.toLowerCase();
|
||||||
if (macs.indexOf(mac) === -1) {
|
if (macs.indexOf(mac) === -1) {
|
||||||
@ -1159,7 +1192,7 @@ function getUniqueMacAdresses() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
macs = macs.sort(function (a, b) {
|
macs = macs.sort((a, b) => {
|
||||||
if (a < b) {
|
if (a < b) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1168,7 +1201,7 @@ function getUniqueMacAdresses() {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch {
|
||||||
macs.push('00:00:00:00:00:00');
|
macs.push('00:00:00:00:00:00');
|
||||||
}
|
}
|
||||||
return macs;
|
return macs;
|
||||||
@ -1185,7 +1218,7 @@ function uuid(callback) {
|
|||||||
let parts;
|
let parts;
|
||||||
|
|
||||||
if (_darwin) {
|
if (_darwin) {
|
||||||
exec('system_profiler SPHardwareDataType -json', function (error, stdout) {
|
exec('system_profiler SPHardwareDataType -json', (error, stdout) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
try {
|
try {
|
||||||
const jsonObj = JSON.parse(stdout.toString());
|
const jsonObj = JSON.parse(stdout.toString());
|
||||||
@ -1194,7 +1227,7 @@ function uuid(callback) {
|
|||||||
result.os = spHardware.platform_UUID.toLowerCase();
|
result.os = spHardware.platform_UUID.toLowerCase();
|
||||||
result.hardware = spHardware.serial_number;
|
result.hardware = spHardware.serial_number;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch {
|
||||||
util.noop();
|
util.noop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1208,7 +1241,7 @@ function uuid(callback) {
|
|||||||
const cmd = `echo -n "os: "; cat /var/lib/dbus/machine-id 2> /dev/null ||
|
const cmd = `echo -n "os: "; cat /var/lib/dbus/machine-id 2> /dev/null ||
|
||||||
cat /etc/machine-id 2> /dev/null; echo;
|
cat /etc/machine-id 2> /dev/null; echo;
|
||||||
echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
|
echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
|
||||||
exec(cmd, function (error, stdout) {
|
exec(cmd, (error, stdout) => {
|
||||||
const lines = stdout.toString().split('\n');
|
const lines = stdout.toString().split('\n');
|
||||||
result.os = util.getValue(lines, 'os').toLowerCase();
|
result.os = util.getValue(lines, 'os').toLowerCase();
|
||||||
result.hardware = util.getValue(lines, 'hardware').toLowerCase();
|
result.hardware = util.getValue(lines, 'hardware').toLowerCase();
|
||||||
@ -1224,7 +1257,7 @@ echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (_freebsd || _openbsd || _netbsd) {
|
if (_freebsd || _openbsd || _netbsd) {
|
||||||
exec('sysctl -i kern.hostid kern.hostuuid', function (error, stdout) {
|
exec('sysctl -i kern.hostid kern.hostuuid', (error, stdout) => {
|
||||||
const lines = stdout.toString().split('\n');
|
const lines = stdout.toString().split('\n');
|
||||||
result.hardware = util.getValue(lines, 'kern.hostid', ':').toLowerCase();
|
result.hardware = util.getValue(lines, 'kern.hostid', ':').toLowerCase();
|
||||||
result.os = util.getValue(lines, 'kern.hostuuid', ':').toLowerCase();
|
result.os = util.getValue(lines, 'kern.hostuuid', ':').toLowerCase();
|
||||||
@ -1248,7 +1281,7 @@ echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
|
|||||||
util.powerShell('Get-CimInstance Win32_ComputerSystemProduct | select UUID | fl').then((stdout) => {
|
util.powerShell('Get-CimInstance Win32_ComputerSystemProduct | select UUID | fl').then((stdout) => {
|
||||||
let lines = stdout.split('\r\n');
|
let lines = stdout.split('\r\n');
|
||||||
result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase();
|
result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase();
|
||||||
exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, function (error, stdout) {
|
exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, (error, stdout) => {
|
||||||
parts = stdout.toString().split('\n\r')[0].split('REG_SZ');
|
parts = stdout.toString().split('\n\r')[0].split('REG_SZ');
|
||||||
result.os = parts.length > 1 ? parts[1].replace(/\r+|\n+|\s+/gi, '').toLowerCase() : '';
|
result.os = parts.length > 1 ? parts[1].replace(/\r+|\n+|\s+/gi, '').toLowerCase() : '';
|
||||||
if (callback) {
|
if (callback) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user