pub network: Network,
#[serde(rename = "disk-setup")]
pub disks: Disks,
- pub system: Option<System>,
}
#[derive(Clone, Deserialize, Debug)]
pub root_password: String,
#[serde(default)]
pub reboot_on_error: bool,
+ #[serde(default)]
+ pub root_ssh_keys: Vec<String>,
}
#[derive(Clone, Deserialize, Debug, Default, PartialEq)]
pub hdsize: Option<f64>,
pub raid: Option<BtrfsRaidLevel>,
}
-
-#[derive(Clone, Default, Deserialize, Debug)]
-#[serde(deny_unknown_fields)]
-pub struct System {
- #[serde(default)]
- pub root_ssh_keys: Vec<String>,
-}
}
fn run_postinstallation(answer: &Answer) {
- if let Some(system) = &answer.system {
- if !system.root_ssh_keys.is_empty() {
- // FIXME: move handling this into the low-level installer and just pass in installation
- // config, as doing parts of the installation/configuration here and parts in the
- // low-level installer is not nice (seemingly spooky actions at a distance).
- info!("Adding root ssh-keys to the installed system ..");
- run_cmds(
- "ssh-key-setup",
- true,
- &[
- "mkdir -p /target/root/.ssh",
- &format!(
- "printf '{}' >>/target/root/.ssh/authorized_keys",
- system.root_ssh_keys.join("\n"),
- ),
- ],
- );
- }
+ if !answer.global.root_ssh_keys.is_empty() {
+ // FIXME: move handling this into the low-level installer and just pass in installation
+ // config, as doing parts of the installation/configuration here and parts in the
+ // low-level installer is not nice (seemingly spooky actions at a distance).
+ info!("Adding root ssh-keys to the installed system ..");
+ run_cmds(
+ "ssh-key-setup",
+ true,
+ &[
+ "mkdir -p /target/root/.ssh",
+ &format!(
+ "printf '{}' >>/target/root/.ssh/authorized_keys",
+ answer.global.root_ssh_keys.join("\n"),
+ ),
+ ],
+ );
}
}