From 1a34cba9fb64c0ab3caff46034c5d15c1409a2dc Mon Sep 17 00:00:00 2001 From: Simon Smith Date: Sun, 8 Oct 2023 10:47:51 +0000 Subject: [PATCH] add bios mode Signed-off-by: Simon Smith --- agents/meshcore.js | 11 +++++++++++ views/default.handlebars | 1 + 2 files changed, 12 insertions(+) diff --git a/agents/meshcore.js b/agents/meshcore.js index 8b73f942..cbf8c206 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -1829,11 +1829,22 @@ function getSystemInformation(func) { var values = require('win-wmi').query('ROOT\\CIMV2', "SELECT * FROM Win32_Bios", ['SerialNumber']); results.hardware.identifiers['bios_serial'] = values[0]['SerialNumber']; } catch (ex) { } + try { + results.hardware.identifiers['bios_mode'] = 'Legacy'; + for (var i in results.hardware.windows.partitions) { + if (results.hardware.windows.partitions[i].Description=='GPT: System') { + results.hardware.identifiers['bios_mode'] = 'UEFI'; + } + } + } catch (ex) { results.hardware.identifiers['bios_mode'] = 'Legacy'; } } if(results.hardware && results.hardware.linux) { if (require('fs').statSync('/sys/class/dmi/id/product_serial').isFile()){ results.hardware.identifiers['bios_serial'] = require('fs').readFileSync('/sys/class/dmi/id/product_serial').toString().trim(); } + try { + results.hardware.identifiers['bios_mode'] = (require('fs').statSync('/sys/firmware/efi').isDirectory() ? 'UEFI': 'Legacy'); + } catch (ex) { results.hardware.identifiers['bios_mode'] = 'Legacy'; } } results.hardware.agentvers = process.versions; replaceSpacesWithUnderscoresRec(results); diff --git a/views/default.handlebars b/views/default.handlebars index de5501d6..701242e9 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -11670,6 +11670,7 @@ if (ident.bios_vendor) { x += addDetailItem("Vendor", EscapeHtml(ident.bios_vendor), s); } if (ident.bios_version) { x += addDetailItem("Version", EscapeHtml(ident.bios_version), s); } if (ident.bios_serial) { x += addDetailItem("Serial", EscapeHtml(ident.bios_serial), s); } + if (ident.bios_mode) { x += addDetailItem("Mode", EscapeHtml(ident.bios_mode), s); } if (x != '') { sections.push({ name: "BIOS", html: x, img: 'chip64.png' }); } // Motherboard