target: Option<PathBuf>,
/// Where to fetch the answer file from.
- #[arg(short, long, value_enum, default_value_t=AutoInstMode::Auto)]
+ #[arg(short, long, value_enum)]
install_mode: AutoInstMode,
/// Include the specified answer file in the ISO. Requires the '--install-mode', '-i' parameter
return specified;
}
let mut suffix: String = match args.install_mode {
- AutoInstMode::Auto => "auto",
AutoInstMode::Http => "auto-http",
AutoInstMode::Included => "auto-answer-included",
AutoInstMode::Partition => "auto-part",
#[derive(Deserialize, Serialize, Debug, Clone, ValueEnum, PartialEq)]
#[serde(rename_all = "lowercase", deny_unknown_fields)]
pub enum AutoInstMode {
- Auto,
Included,
Http,
Partition,
fn fetch_answer(install_settings: &AutoInstSettings) -> Result<String> {
info!("Fetching answer file in mode {:?}:", &install_settings.mode);
match install_settings.mode {
- AutoInstMode::Auto => {
- match FetchFromPartition::get_answer() {
- Ok(answer) => return Ok(answer),
- Err(err) => info!("Fetching answer file from partition failed: {err}"),
- }
- match FetchFromHTTP::get_answer(install_settings) {
- Ok(answer) => return Ok(answer),
- Err(err) => info!("Fetching answer file via HTTP failed: {err}"),
- }
- }
AutoInstMode::Included => {
let answer_path = PathBuf::from("/cdrom/answer.toml");
match fs::read_to_string(answer_path) {