Skip to content
Snippets Groups Projects
Commit 5cdec468 authored by bjorn3's avatar bjorn3
Browse files

Reserialize filesystem.toml instead of copying the original config

This will be necessary to handle including other configs from the config
to use as these configs will not be copied.
parent c9e091be
No related branches found
No related tags found
1 merge request!29Support including other config files from a config file
...@@ -55,7 +55,7 @@ fn main() { ...@@ -55,7 +55,7 @@ fn main() {
// Add filesystem.toml to config // Add filesystem.toml to config
config.files.push(redox_installer::FileConfig { config.files.push(redox_installer::FileConfig {
path: "filesystem.toml".to_string(), path: "filesystem.toml".to_string(),
data: config_data, data: toml::to_string_pretty(&config).unwrap(),
..Default::default() ..Default::default()
}); });
......
...@@ -29,7 +29,7 @@ fn chown<P: AsRef<Path>>(path: P, uid: uid_t, gid: gid_t, recursive: bool) -> Re ...@@ -29,7 +29,7 @@ fn chown<P: AsRef<Path>>(path: P, uid: uid_t, gid: gid_t, recursive: bool) -> Re
Ok(()) Ok(())
} }
#[derive(Clone, Debug, Default, Deserialize)] #[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct FileConfig { pub struct FileConfig {
pub path: String, pub path: String,
pub data: String, pub data: String,
......
#[derive(Clone, Debug, Default, Deserialize)] #[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct GeneralConfig { pub struct GeneralConfig {
pub prompt: bool, pub prompt: bool,
// Allow config to specify cookbook recipe or binary package as default // Allow config to specify cookbook recipe or binary package as default
......
...@@ -5,7 +5,7 @@ pub mod file; ...@@ -5,7 +5,7 @@ pub mod file;
pub mod package; pub mod package;
pub mod user; pub mod user;
#[derive(Clone, Debug, Default, Deserialize)] #[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct Config { pub struct Config {
pub general: general::GeneralConfig, pub general: general::GeneralConfig,
#[serde(default)] #[serde(default)]
......
#[derive(Clone, Debug, Deserialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum PackageConfig { pub enum PackageConfig {
Empty, Empty,
......
#[derive(Clone, Debug, Default, Deserialize)] #[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UserConfig { pub struct UserConfig {
pub password: Option<String>, pub password: Option<String>,
pub uid: Option<u32>, pub uid: Option<u32>,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment