blob: 2c648c09383a23766fdca10bafa119e8640c73c6 [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>
Alex Vakulenko75039d72014-03-25 12:36:28 -070011#include <base/files/file_path.h>
Chris Masonef8d037f2014-02-19 01:53:00 +000012#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;
Alex Vakulenko75039d72014-03-25 12:36:28 -070031 if (base::ReadFileToString(kFile, &file_data)) {
Chris Masonef8d037f2014-02-19 01:53:00 +000032 data = simple_key_value_store::ParseString(file_data);
33 }
34 return data[kHwidOverrideKey];
35}
36
37} // namespace chromeos_update_engine