blob: 90173a06e4bb0bc2ab07a3897fa5c9ef5cbf401e [file] [log] [blame]
Alex Deymoaea4c1c2015-08-19 20:24:43 -07001//
2// Copyright (C) 2014 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
Alex Deymobd04b142014-03-18 15:00:05 -070016
Alex Deymo63784a52014-05-28 10:46:14 -070017#include "update_engine/update_manager/real_system_provider.h"
Alex Deymobd04b142014-03-18 15:00:05 -070018
Gilad Arnold48e13612014-05-16 10:18:05 -070019#include <string.h>
20#include <sys/stat.h>
21#include <sys/types.h>
22#include <unistd.h>
23
Alex Deymobd04b142014-03-18 15:00:05 -070024#include <string>
25#include <vector>
26
27#include <base/logging.h>
Gilad Arnold48e13612014-05-16 10:18:05 -070028#include <base/strings/stringprintf.h>
29#include <base/time/time.h>
Alex Deymobd04b142014-03-18 15:00:05 -070030
Alex Deymo63784a52014-05-28 10:46:14 -070031#include "update_engine/update_manager/generic_variables.h"
Alex Deymobd04b142014-03-18 15:00:05 -070032#include "update_engine/utils.h"
33
34using std::string;
Alex Deymobd04b142014-03-18 15:00:05 -070035
Alex Deymo63784a52014-05-28 10:46:14 -070036namespace chromeos_update_manager {
Alex Deymobd04b142014-03-18 15:00:05 -070037
Alex Deymo42c30c32014-04-24 18:41:18 -070038bool RealSystemProvider::Init() {
David Zeuthen21716e22014-04-23 15:42:05 -070039 var_is_normal_boot_mode_.reset(
Alex Deymobd04b142014-03-18 15:00:05 -070040 new ConstCopyVariable<bool>("is_normal_boot_mode",
Alex Deymo40d86b22015-09-03 22:27:10 -070041 hardware_->IsNormalBootMode()));
Alex Deymobd04b142014-03-18 15:00:05 -070042
David Zeuthen21716e22014-04-23 15:42:05 -070043 var_is_official_build_.reset(
Gilad Arnold48e13612014-05-16 10:18:05 -070044 new ConstCopyVariable<bool>("is_official_build",
Alex Deymo40d86b22015-09-03 22:27:10 -070045 hardware_->IsOfficialBuild()));
Alex Deymobd04b142014-03-18 15:00:05 -070046
Gilad Arnold48e13612014-05-16 10:18:05 -070047 var_is_oobe_complete_.reset(
48 new CallCopyVariable<bool>(
49 "is_oobe_complete",
50 base::Bind(&chromeos_update_engine::HardwareInterface::IsOOBEComplete,
51 base::Unretained(hardware_), nullptr)));
52
Alex Deymo763e7db2015-08-27 21:08:08 -070053 var_num_slots_.reset(
54 new ConstCopyVariable<unsigned int>(
55 "num_slots", boot_control_->GetNumSlots()));
Gilad Arnoldbfc44f72014-07-09 14:41:39 -070056
Alex Deymobd04b142014-03-18 15:00:05 -070057 return true;
58}
59
Alex Deymo63784a52014-05-28 10:46:14 -070060} // namespace chromeos_update_manager