Re-land "Add ability to check /etc/lsb-release for HWID"

This reverts commit 33ab35b140d9d0da49d971cad26fb2f1b52215b0.


Add ability to check /etc/lsb-release for HWID

This is enabled by a compile-time option, only.

On certain boards HWID may not be available via normal means.
This functionality allows a compile-time choice to enable
behavior that will check /etc/lsb-release for an
HWID_OVERRIDE=<id> entry instead.

CQ-DEPEND=CL:186482
BUG=None
TEST=unit tests

Change-Id: I75a7bcf7219fbb19670647746735c814dacf7879
Reviewed-on: https://chromium-review.googlesource.com/187040
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
diff --git a/hardware.cc b/hardware.cc
index 6213739..26435cf 100644
--- a/hardware.cc
+++ b/hardware.cc
@@ -20,6 +20,7 @@
 const char* command = "";
 void (*uuid_generator)(uint8_t* buffer) = NULL;
 
+#include "update_engine/hwid_override.h"
 #include "update_engine/subprocess.h"
 #include "update_engine/utils.h"
 
@@ -28,6 +29,10 @@
 
 namespace chromeos_update_engine {
 
+Hardware::Hardware() {}
+
+Hardware::~Hardware() {}
+
 const string Hardware::BootKernelDevice() {
   return utils::KernelDeviceOfBootDevice(Hardware::BootDevice());
 }
@@ -128,6 +133,9 @@
 }
 
 string Hardware::GetHardwareClass() {
+  if (USE_HWID_OVERRIDE) {
+    return HwidOverride::Read(base::FilePath("/"));
+  }
   return ReadValueFromCrosSystem("hwid");
 }