diff --git a/src/bootupd.rs b/src/bootupd.rs
index 13a04424..f912d439 100644
--- a/src/bootupd.rs
+++ b/src/bootupd.rs
@@ -243,8 +243,13 @@ pub(crate) fn print_status(status: &Status) -> Result<()> {
if status.adoptable.is_empty() {
println!("No components are adoptable.");
}
- for (name, version) in status.adoptable.iter() {
- println!("Adoptable: {}: {}", name, version.version);
+ for (name, adopt) in status.adoptable.iter() {
+ let ver = &adopt.version.version;
+ if adopt.confident {
+ println!("Detected: {}: {}", name, ver);
+ } else {
+ println!("Adoptable: {}: {}", name, ver);
+ }
}
if let Some(coreos_aleph) = coreos::get_aleph_version()? {
@@ -266,7 +271,7 @@ pub(crate) fn print_status(status: &Status) -> Result<()> {
pub(crate) fn client_run_update(c: &mut ipc::ClientToDaemonConnection) -> Result<()> {
let status: Status = c.send(&ClientRequest::Status)?;
- if status.components.is_empty() {
+ if status.components.is_empty() && status.adoptable.is_empty() {
println!("No components installed.");
return Ok(());
}
@@ -303,6 +308,17 @@ pub(crate) fn client_run_update(c: &mut ipc::ClientToDaemonConnection) -> Result
}
updated = true;
}
+ for (name, adoptable) in status.adoptable.iter() {
+ if adoptable.confident {
+ let r: ContentMetadata = c.send(&ClientRequest::AdoptAndUpdate {
+ component: name.to_string(),
+ })?;
+ println!("Adopted and updated: {}: {}", name, r.version);
+ updated = true;
+ } else {
+ println!("Component {} requires explicit adopt-and-update", name);
+ }
+ }
if !updated {
println!("No update available for any component.");
}
diff --git a/src/component.rs b/src/component.rs
index 141a5cde..089c9ad6 100644
--- a/src/component.rs
+++ b/src/component.rs
@@ -27,7 +27,7 @@ pub(crate) trait Component {
/// In an operating system whose initially booted disk image is not
/// using bootupd, detect whether it looks like the component exists
/// and "synthesize" content metadata from it.
- fn query_adopt(&self) -> Result