blob: 90e413b0f29bda406550d5066227eddd598d3a54 [file] [log] [blame]
Chris Masonef8d037f2014-02-19 01:53:00 +00001// 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
16using std::map;
17using std::string;
18
19namespace chromeos_update_engine {
20
21const char HwidOverride::kHwidOverrideKey[] = "HWID_OVERRIDE";
22
23HwidOverride::HwidOverride() {}
24
25HwidOverride::~HwidOverride() {}
26
27std::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