1// Copyright 2022 The Fuchsia 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.
45#![deny(missing_docs)]
6#![allow(clippy::let_unit_value)]
7#![allow(clippy::type_complexity)]
89//! Component that implements the fuchsia.update.config.OptOut and
10//! fuchsia.update.config.OptOutAdmin protocols.
1112use anyhow::{Context, Error};
13use fuchsia_component::server::ServiceFs;
14use log::{error, info};
1516pub mod bridge;
17mod health;
18mod service;
1920/// main() entry point to this binary that is actually a library aggregated with other binaries in
21/// the //src/sys/pkg/bin/grand-swd-binary.
22#[fuchsia::main(logging = true)]
23pub async fn main() -> Result<(), Error> {
24info!("starting system-update-configurator");
2526if let Err(e) = run().await {
27error!("error running system-update-configurator: {e:#}")
28 }
2930info!("shutting down system-update-configurator");
31Ok(())
32}
3334async fn run() -> Result<(), Error> {
35let inspector = fuchsia_inspect::Inspector::default();
36let _inspect_server_task =
37 inspect_runtime::publish(&inspector, inspect_runtime::PublishOptions::default());
38let health_status = health::HealthStatus::new(inspector.root());
3940let mut fs: service::Fs = ServiceFs::new_local();
41 fs.take_and_serve_directory_handle().context("while taking outdir handle")?;
4243let storage = bridge::OptOutStorage;
4445let mut storage = health_status.wrap_bridge(storage);
4647 service::serve(fs, &mut storage).await;
4849Ok(())
50}