Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions rust/agama-autoinstall/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ use std::{process::exit, time::Duration};

use agama_autoinstall::{ConfigAutoLoader, ScriptsRunner};
use agama_lib::{auth::AuthToken, http::BaseHTTPClient, manager::ManagerHTTPClient};
use agama_utils::{api::status::Stage, kernel_cmdline::KernelCmdline};
use agama_utils::{
api::{status::Stage, FinishMethod},
kernel_cmdline::KernelCmdline,
};
use anyhow::anyhow;
use tokio::time::sleep;

Expand Down Expand Up @@ -93,7 +96,8 @@ async fn main() -> anyhow::Result<()> {
}
}

manager_client.finish(None).await?;
let method = FinishMethod::from_kernel_cmdline().unwrap_or(FinishMethod::Reboot);
manager_client.finish(method).await?;

Ok(())
}
2 changes: 2 additions & 0 deletions rust/agama-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ async fn finish(
) -> anyhow::Result<()> {
wait_until_idle(monitor.clone()).await?;

let method = method
.unwrap_or_else(|| FinishMethod::from_kernel_cmdline().unwrap_or(FinishMethod::Reboot));
manager.finish(method).await?;
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion rust/agama-lib/src/manager/http_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl ManagerHTTPClient {
/// Finishes the installation.
///
/// * `method`: halt, reboot, stop or poweroff the system.
pub async fn finish(&self, method: Option<FinishMethod>) -> Result<(), ManagerHTTPClientError> {
pub async fn finish(&self, method: FinishMethod) -> Result<(), ManagerHTTPClientError> {
let action = api::Action::Finish(method);
self.client.post_void("/v2/action", &action).await?;
Ok(())
Expand Down
Loading
Loading