blob: 8d5f4f4ec136bc0918ae16d8f839680b33aaf7d5 [file] [log] [blame]
Alex Deymobd04b142014-03-18 15:00:05 -07001// Copyright (c) 2014 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
Alex Deymo63784a52014-05-28 10:46:14 -07005#include "update_engine/update_manager/real_system_provider.h"
Alex Deymobd04b142014-03-18 15:00:05 -07006
Gilad Arnold48e13612014-05-16 10:18:05 -07007#include <string.h>
8#include <sys/stat.h>
9#include <sys/types.h>
10#include <unistd.h>
11
Alex Deymobd04b142014-03-18 15:00:05 -070012#include <string>
13#include <vector>
14
15#include <base/logging.h>
Gilad Arnold48e13612014-05-16 10:18:05 -070016#include <base/strings/stringprintf.h>
17#include <base/time/time.h>
Alex Deymobd04b142014-03-18 15:00:05 -070018#include <vboot/crossystem.h>
19
Alex Deymo63784a52014-05-28 10:46:14 -070020#include "update_engine/update_manager/generic_variables.h"
Alex Deymobd04b142014-03-18 15:00:05 -070021#include "update_engine/utils.h"
22
Gilad Arnold48e13612014-05-16 10:18:05 -070023using base::StringPrintf;
24using base::Time;
25using base::TimeDelta;
Alex Deymobd04b142014-03-18 15:00:05 -070026using std::string;
27using std::vector;
28
Alex Deymo63784a52014-05-28 10:46:14 -070029namespace chromeos_update_manager {
Alex Deymobd04b142014-03-18 15:00:05 -070030
Alex Deymo42c30c32014-04-24 18:41:18 -070031bool RealSystemProvider::Init() {
David Zeuthen21716e22014-04-23 15:42:05 -070032 var_is_normal_boot_mode_.reset(
Alex Deymobd04b142014-03-18 15:00:05 -070033 new ConstCopyVariable<bool>("is_normal_boot_mode",
34 VbGetSystemPropertyInt("devsw_boot") != 0));
35
David Zeuthen21716e22014-04-23 15:42:05 -070036 var_is_official_build_.reset(
Gilad Arnold48e13612014-05-16 10:18:05 -070037 new ConstCopyVariable<bool>("is_official_build",
Alex Deymobd04b142014-03-18 15:00:05 -070038 VbGetSystemPropertyInt("debug_build") == 0));
39
Gilad Arnold48e13612014-05-16 10:18:05 -070040 var_is_oobe_complete_.reset(
41 new CallCopyVariable<bool>(
42 "is_oobe_complete",
43 base::Bind(&chromeos_update_engine::HardwareInterface::IsOOBEComplete,
44 base::Unretained(hardware_), nullptr)));
45
Gilad Arnoldbfc44f72014-07-09 14:41:39 -070046 var_is_boot_device_removable_.reset(
47 new ConstCopyVariable<bool>("is_boot_device_removable",
48 hardware_->IsBootDeviceRemovable()));
49
Alex Deymobd04b142014-03-18 15:00:05 -070050 return true;
51}
52
Alex Deymo63784a52014-05-28 10:46:14 -070053} // namespace chromeos_update_manager