persist hostname in config overlay (#2769)

* persist hostname

* add migration

* fix version mismatch

* remove dmesg logging from build
This commit is contained in:
Aiden McClelland
2024-10-30 12:55:36 -06:00
committed by GitHub
parent 480f5c1a9a
commit 2091abeea2
17 changed files with 105 additions and 73 deletions

View File

@@ -10,6 +10,7 @@ use rpc_toolkit::yajrc::RpcError;
use rpc_toolkit::{from_fn_async, Context, HandlerExt, ParentHandler};
use serde::{Deserialize, Serialize};
use tokio::io::AsyncWriteExt;
use tokio::process::Command;
use tokio::try_join;
use tracing::instrument;
use ts_rs::TS;
@@ -36,6 +37,7 @@ use crate::progress::{FullProgress, PhaseProgressTrackerHandle};
use crate::rpc_continuations::Guid;
use crate::util::crypto::EncryptedWire;
use crate::util::io::{create_file, dir_copy, dir_size, Counter};
use crate::util::Invoke;
use crate::{Error, ErrorKind, ResultExt};
pub fn setup<C: Context>() -> ParentHandler<C> {
@@ -336,6 +338,11 @@ pub async fn complete(ctx: SetupContext) -> Result<SetupResult, Error> {
let mut guid_file = create_file("/media/startos/config/disk.guid").await?;
guid_file.write_all(ctx.disk_guid.as_bytes()).await?;
guid_file.sync_all().await?;
Command::new("systemd-firstboot")
.arg("--root=/media/startos/config/overlay/")
.arg(format!("--hostname={}", res.hostname.0))
.invoke(ErrorKind::ParseSysInfo)
.await?;
Ok(res.clone())
}
Some(Err(e)) => Err(e.clone_output()),