diff options
author | Renato Botelho <renato@netgate.com> | 2016-03-28 17:12:34 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-03-28 17:12:46 -0300 |
commit | 884914ce08da9617c423d1f1f1974cd2c743c39e (patch) | |
tree | f49c98c70c2a4221241f6c1ab9c9c4cf8d02d58b /src/etc | |
parent | 98b9c3049844775cf80617d5ffe876c6575507c0 (diff) | |
download | pfsense-884914ce08da9617c423d1f1f1974cd2c743c39e.zip pfsense-884914ce08da9617c423d1f1f1974cd2c743c39e.tar.gz |
Implement system_get_serial()
Diffstat (limited to 'src/etc')
-rw-r--r-- | src/etc/inc/system.inc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index fb8ea2c..e1b096e 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -2166,6 +2166,21 @@ EOD; return 0; } +function system_get_serial() { + unset($output); + $_gb = exec('/bin/kenv smbios.system.serial 2>/dev/null', $output); + $serial = $output[0]; + + $vm_guest = get_single_sysctl('kern.vm_guest'); + + if (strlen($serial) >= 10 && strlen($serial) <= 16 && + $vm_guest == 'none') { + return $serial; + } + + return get_single_sysctl('kern.hostuuid'); +} + /* * attempt to identify the specific platform (for embedded systems) * Returns an array with two elements: |