blob: 78d5036851c3d808a4f435384260f4c011b1c44e [file] [log] [blame]
Jay Srinivasan43488792012-06-19 00:25:31 -07001// Copyright (c) 2012 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 <base/file_util.h>
6
7#include "update_engine/system_state.h"
8
9namespace chromeos_update_engine {
10
11static const char kOOBECompletedMarker[] = "/home/chronos/.oobe_completed";
Jay Srinivasan6f6ea002012-12-14 11:26:28 -080012static const char kPrefsDirectory[] = "/var/lib/update_engine/prefs";
Jay Srinivasan43488792012-06-19 00:25:31 -070013
Jay Srinivasan34b5d862012-07-23 11:43:22 -070014RealSystemState::RealSystemState()
15 : device_policy_(NULL),
Jay Srinivasan6f6ea002012-12-14 11:26:28 -080016 connection_manager_(this) {}
17
18bool RealSystemState::Initialize() {
19 metrics_lib_.Init();
20
21 if (!prefs_.Init(FilePath(kPrefsDirectory))) {
22 LOG(ERROR) << "Failed to initialize preferences.";
23 return false;
24 }
25
26 if (!payload_state_.Initialize(&prefs_))
27 return false;
28
29 // All is well. Initialization successful.
30 return true;
31}
Jay Srinivasan43488792012-06-19 00:25:31 -070032
33bool RealSystemState::IsOOBEComplete() {
34 return file_util::PathExists(FilePath(kOOBECompletedMarker));
35}
36
Jay Srinivasan43488792012-06-19 00:25:31 -070037} // namespace chromeos_update_engine