| # Copyright 2021 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 system-update-committer configuration data to be included in the |
| # config-data package. |
| # |
| # Parameters |
| # |
| # blobfs (required) |
| # Whether to ignore or reboot_on_failure when the blobfs verification fails. |
| # Type: string |
| # Possible values: ignore | reboot_on_failure |
| # netstack (required) |
| # Whether to ignore or reboot_on_failure when the netstack verification fails. |
| # Type: string |
| # Possible values: ignore | reboot_on_failure |
| # enable (optional) |
| # If false, completely disable the system-update-committer. |
| # Type: bool |
| # Default: true |
| template("system_update_committer_config") { |
| cfg = { |
| forward_variables_from(invoker, |
| [ |
| "blobfs", |
| "netstack", |
| ]) |
| assert(defined(blobfs), "blobfs must be defined") |
| assert(blobfs == "reboot_on_failure" || blobfs == "ignore", |
| "blobfs value must be reboot_on_failure or ignore") |
| assert(defined(netstack), "netstack must be defined") |
| assert(netstack == "reboot_on_failure" || netstack == "ignore", |
| "netstack value must be reboot_on_failure or ignore") |
| enable = true |
| if (defined(invoker.enable)) { |
| assert(invoker.enable == true || invoker.enable == false, |
| "value must be true or false") |
| enable = invoker.enable |
| } |
| } |
| |
| config_path = |
| "$target_gen_dir/system_update_committer_config_$target_name.json" |
| |
| write_file(config_path, cfg, "json") |
| |
| config_data(target_name) { |
| for_pkg = "system-update-committer" |
| outputs = [ "config.json" ] |
| sources = [ config_path ] |
| forward_variables_from(invoker, [ "deps" ]) |
| } |
| } |