diff options
author | Renato Botelho <renato@netgate.com> | 2017-07-05 12:59:23 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-07-05 12:59:23 -0300 |
commit | 2f8793b72811d13a6b46244e17ae452d061e8a05 (patch) | |
tree | f9568cb7dd19f0cdee17660b991ab6b2587adf23 /src/etc | |
parent | 38d110824c87ff60c6289c0432d55009586ceee4 (diff) | |
download | pfsense-2f8793b72811d13a6b46244e17ae452d061e8a05.zip pfsense-2f8793b72811d13a6b46244e17ae452d061e8a05.tar.gz |
Move uniqueid read to a function system_get_uniqueid()
Diffstat (limited to 'src/etc')
-rw-r--r-- | src/etc/inc/system.inc | 18 |
1 files changed, 18 insertions, 0 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: |