diff options
author | Renato Botelho <renato@netgate.com> | 2015-07-31 10:10:30 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-07-31 10:10:30 -0300 |
commit | 96bf5038debcfe764f3b853d7bdb62faded7b996 (patch) | |
tree | 88e528a0919a9daacb2f8253bb8b583e9c4f170f /etc/inc | |
parent | fdc5447bd5e8d8a71d15ac5eefe7795736db7ba7 (diff) | |
download | pfsense-96bf5038debcfe764f3b853d7bdb62faded7b996.zip pfsense-96bf5038debcfe764f3b853d7bdb62faded7b996.tar.gz |
Add UUID to pkg user agent
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/pkg-utils.inc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index a9bc25d..d279a40 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -84,14 +84,19 @@ function pkg_remove_prefix(&$pkg_name) { /* Execute a pkg call */ function pkg_call($params, $mute = false) { - global $static_output, $g; + global $static_output, $g, $config; if (empty($params)) { return false; } + $user_agent = $g['product_name'] . '/' . $g['product_version']; + if (!isset($config['system']['host_uuid'])) { + $user_agent .= ' : ' . get_single_sysctl('kern.hostuuid')); + } + $env = array( - "HTTP_USER_AGENT" => $g['product_name'] . '/' . $g['product_version'], + "HTTP_USER_AGENT" => $user_agent, "ASSUME_ALWAYS_YES" => "true" ); @@ -169,14 +174,19 @@ function pkg_call($params, $mute = false) { /* Execute pkg with $params, fill stdout and stderr and return pkg rc */ function pkg_exec($params, &$stdout, &$stderr) { - global $g; + global $g, $config; if (empty($params)) { return -1; } + $user_agent = $g['product_name'] . '/' . $g['product_version']; + if (!isset($config['system']['host_uuid'])) { + $user_agent .= ' : ' . get_single_sysctl('kern.hostuuid')); + } + $env = array( - "HTTP_USER_AGENT" => $g['product_name'] . '/' . $g['product_version'], + "HTTP_USER_AGENT" => $user_agent, "ASSUME_ALWAYS_YES" => "true" ); |