blob: 5a4642fd697d8893a17ab62fd42dd9fc6785b6e0 [file] [log] [blame]
# Copyright 2020 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config.gni")
# Define Omaha Client configuration data to be included in the
# config-data package. Invokers must configure at least one of
# periodic_interval_minutes, startupd_delay_seconds, or retry_delay_seconds.
#
# periodic_interval_minutes (optional)
# [int] The number of minutes between update checks. Defaults to 60.
#
# startup_delay_seconds (optional)
# [int] How many seconds to wait after system start before starting
# the OMCL state machine and checking for an update.
#
# retry_delay_seconds (optional)
# [int] The number of seconds to wait after a failed update check
# before retrying.
#
# allow_reboot_when_idle (optional)
# [bool] Whether or not to reboot when idle. Defaults to "true".
#
# for_pkg (optional)
# [string] The package to make a config_data blob for. Defaults to
# "omaha-client"
template("omcl_policy_config") {
forward_variables_from(invoker,
[
"for_pkg",
"testonly",
])
cfg = {
forward_variables_from(invoker,
[
"periodic_interval_minutes",
"startup_delay_seconds",
"retry_delay_seconds",
"allow_reboot_when_idle",
])
assert(
defined(periodic_interval_minutes) || defined(startup_delay_seconds) ||
defined(retry_delay_seconds) || defined(allow_reboot_when_idle),
"at least one config parameter should be defined")
}
if (!defined(for_pkg)) {
for_pkg = "omaha-client"
}
config_path = "$target_gen_dir/policy_config.json"
generated_file("omcl_policy_config_json") {
outputs = [ config_path ]
contents = cfg
output_conversion = "json"
}
config_data(target_name) {
outputs = [ "policy_config.json" ]
sources = [ config_path ]
}
}