summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/system.inc18
-rw-r--r--src/usr/local/www/widgets/widgets/system_information.widget.php6
2 files changed, 21 insertions, 3 deletions
diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc
index c7c6be2..ed93d0f 100644
--- a/src/etc/inc/system.inc
+++ b/src/etc/inc/system.inc
@@ -2345,6 +2345,24 @@ function system_get_serial() {
return get_single_sysctl('kern.hostuuid');
}
+function system_get_uniqueid() {
+ global $g;
+
+ $uniqueid_file="{$g['vardb_path']}/uniqueid";
+
+ if (empty($g['uniqueid'])) {
+ if (!file_exists($uniqueid_file)) {
+ mwexec("/usr/sbin/gnid > {$g['vardb_path']}/uniqueid " .
+ "2>/dev/null");
+ }
+ if (file_exists($uniqueid_file)) {
+ $g['uniqueid'] = @file_get_contents($uniqueid_file);
+ }
+ }
+
+ return ($g['uniqueid'] ?: '');
+}
+
/*
* attempt to identify the specific platform (for embedded systems)
* Returns an array with two elements:
diff --git a/src/usr/local/www/widgets/widgets/system_information.widget.php b/src/usr/local/www/widgets/widgets/system_information.widget.php
index 838ee72..2109d3e 100644
--- a/src/usr/local/www/widgets/widgets/system_information.widget.php
+++ b/src/usr/local/www/widgets/widgets/system_information.widget.php
@@ -159,9 +159,9 @@ $rows_displayed = false;
<?=gettext("Serial: ");?><strong><?=system_get_serial();?></strong>
<?php
// If the uniqueID is available, display it here
- $idfile = "/var/db/uniqueid";
- if (file_exists($idfile)) {
- print("<br />" . gettext("Netgate Device ID:") . " <strong>" . file_get_contents($idfile) . "</strong>");
+ $uniqueid = system_get_uniqueid();
+ if (!empty($uniqueid)) {
+ print("<br />" . gettext("Netgate Device ID:") . " <strong>{$uniqueid}</strong>");
}
?>
</td>
OpenPOWER on IntegriCloud