2026-04-18 19:02:46 +02:00
|
|
|
// <Kira Installer - universal Linux installer.>
|
|
|
|
|
// Copyright (C) <2026> <Kira Foundation>
|
|
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
This file contains basic enums and structs to be used with stages.
|
|
|
|
|
*/
|
2026-04-16 00:29:43 +02:00
|
|
|
|
|
|
|
|
use std::collections::HashMap;
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
|
pub enum ConfigValue {
|
|
|
|
|
String(String),
|
|
|
|
|
I64(i64),
|
|
|
|
|
U64(u64),
|
|
|
|
|
F64(f64),
|
|
|
|
|
Bool(bool),
|
|
|
|
|
Vector(Vec<ConfigValue>),
|
|
|
|
|
Dictionary(HashMap<String, ConfigValue>)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
|
pub struct StageResult {
|
|
|
|
|
pub name: String,
|
|
|
|
|
pub config: Option<HashMap<String, ConfigValue>>,
|
|
|
|
|
pub resuts: Option<HashMap<String, ConfigValue>>,
|
|
|
|
|
pub error: Option<String>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
|
pub enum StageAction {
|
|
|
|
|
Back,
|
|
|
|
|
None,
|
|
|
|
|
Next(StageResult),
|
2026-05-01 23:32:25 +02:00
|
|
|
Abort,
|
2026-04-16 00:29:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub struct KiraConfig {
|
|
|
|
|
pub config_trail: Vec<StageResult>,
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-03 00:56:20 +02:00
|
|
|
impl KiraConfig {
|
|
|
|
|
pub fn get_stage(&self, name: &str) -> Option<StageResult> {
|
|
|
|
|
self.config_trail.iter().find(|v| v.name == name)
|
|
|
|
|
.and_then(|v| Some(v.clone()))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2026-04-16 00:29:43 +02:00
|
|
|
|