Chris Masone | f8d037f | 2014-02-19 01:53:00 +0000 | [diff] [blame^] | 1 | // Copyright (c) 2013 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "update_engine/hwid_override.h" |
| 6 | |
| 7 | #include <map> |
| 8 | #include <string> |
| 9 | |
| 10 | #include <base/basictypes.h> |
| 11 | #include <base/file_path.h> |
| 12 | #include <base/file_util.h> |
| 13 | |
| 14 | #include "update_engine/simple_key_value_store.h" |
| 15 | |
| 16 | using std::map; |
| 17 | using std::string; |
| 18 | |
| 19 | namespace chromeos_update_engine { |
| 20 | |
| 21 | const char HwidOverride::kHwidOverrideKey[] = "HWID_OVERRIDE"; |
| 22 | |
| 23 | HwidOverride::HwidOverride() {} |
| 24 | |
| 25 | HwidOverride::~HwidOverride() {} |
| 26 | |
| 27 | std::string HwidOverride::Read(const base::FilePath& root) { |
| 28 | base::FilePath kFile(root.value() + "/etc/lsb-release"); |
| 29 | string file_data; |
| 30 | map<string, string> data; |
| 31 | if (file_util::ReadFileToString(kFile, &file_data)) { |
| 32 | data = simple_key_value_store::ParseString(file_data); |
| 33 | } |
| 34 | return data[kHwidOverrideKey]; |
| 35 | } |
| 36 | |
| 37 | } // namespace chromeos_update_engine |