osInfo() improved fqdn (linux)

This commit is contained in:
Sebastian Hildebrandt 2023-06-03 19:24:26 +02:00
parent bab409fbc1
commit 216eda32e1
4 changed files with 19 additions and 7 deletions

View File

@ -82,6 +82,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment | | Version | Date | Comment |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- | | ------- | ---------- | --------------------------------------------------------------------------------------------------- |
| 5.17.17 | 2023-06-03 | `osInfo()` improved fqdn (linux) |
| 5.17.16 | 2023-05-30 | `usb()` fix parsing JSON (mac OS) | | 5.17.16 | 2023-05-30 | `usb()` fix parsing JSON (mac OS) |
| 5.17.15 | 2023-05-29 | `powershell()` added NoProfile to speed up powershell (windows) | | 5.17.15 | 2023-05-29 | `powershell()` added NoProfile to speed up powershell (windows) |
| 5.17.14 | 2023-05-29 | `diskLayout()`, `osInfo()` fix parsing issues (mac OS) | | 5.17.14 | 2023-05-29 | `diskLayout()`, `osInfo()` fix parsing issues (mac OS) |

View File

@ -57,6 +57,11 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<th scope="row">5.17.17</th>
<td>2023-06-03</td>
<td><span class="code">osInfo()</span> improved fqdn (linux)</td>
</tr>
<tr> <tr>
<th scope="row">5.17.16</th> <th scope="row">5.17.16</th>
<td>2023-05-30</td> <td>2023-05-30</td>

View File

@ -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>&nbsp;</div> <div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.17.13</span></div> <div class="version">New Version: <span id="version">5.17.17</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">

View File

@ -168,15 +168,21 @@ function getFQDN() {
let fqdn = os.hostname; let fqdn = os.hostname;
if (_linux || _darwin) { if (_linux || _darwin) {
try { try {
const stdout = execSync('hostname -f'); const stdout = execSync('hostnamectl --json short 2>/dev/null');
fqdn = stdout.toString().split(os.EOL)[0]; const json = JSON.parse(stdout.toString());
fqdn = json['StaticHostname'];
} catch (e) { } catch (e) {
util.noop(); try {
const stdout = execSync('hostname -f 2>/dev/null');
fqdn = stdout.toString().split(os.EOL)[0];
} catch (e) {
util.noop();
}
} }
} } if (_freebsd || _openbsd || _netbsd) {
if (_freebsd || _openbsd || _netbsd) {
try { try {
const stdout = execSync('hostname'); const stdout = execSync('hostname 2>/dev/null');
fqdn = stdout.toString().split(os.EOL)[0]; fqdn = stdout.toString().split(os.EOL)[0];
} catch (e) { } catch (e) {
util.noop(); util.noop();