Skip to content
Snippets Groups Projects
Commit b23b2f6e authored by Ron Williams's avatar Ron Williams
Browse files

fix mixed build in a new clone

parent c4a7020e
No related branches found
No related tags found
1 merge request!19fix mixed build in a new clone
......@@ -18,7 +18,7 @@ fn main() {
let mut parser = ArgParser::new(4)
.add_opt("b", "cookbook")
.add_opt("c", "config")
.add_flag(&["cooking"])
.add_flag(&["p", "cooking"])
.add_flag(&["l", "list-packages"])
.add_flag(&["live"]);
parser.parse(env::args());
......@@ -96,18 +96,32 @@ fn main() {
// Add cookbook key to config
let key_path = Path::new(&path).join("build/id_ed25519.pub.toml");
match fs::read_to_string(&key_path) {
Ok(data) => config.files.push(redox_installer::FileConfig {
path: "pkg/id_ed25519.pub.toml".to_string(),
data: data,
..Default::default()
}),
Ok(data) => {
config.files.push(redox_installer::FileConfig {
path: "pkg/id_ed25519.pub.toml".to_string(),
data: data,
..Default::default()
});
Some(path)
},
Err(err) => {
writeln!(stderr, "installer: {}: failed to read cookbook key: {}", key_path.display(), err).unwrap();
process::exit(1);
// if there are no recipes coming from the cookbook, this is not a fatal error
if config.packages.clone().into_iter().any(| (_packagename, package) |
match package {
PackageConfig::Empty => false,
PackageConfig::Spec { version: None, git: None, path: None, } => false,
_ => true,
})
{
writeln!(stderr, "installer: {}: failed to read cookbook key: {}", key_path.display(), err).unwrap();
process::exit(1);
} else {
writeln!(stderr, "installer: {}: (non-fatal) missing cookbook key: {}", key_path.display(), err).unwrap();
None
}
}
}
Some(path)
} else {
None
};
......
......@@ -334,7 +334,7 @@ pub fn with_redoxfs<D, T, F>(disk: D, password_opt: Option<&[u8]>, callback: F)
res
}
pub fn fetch_bootloaders<S: AsRef<str>>(cookbook: Option<S>, live: bool) -> Result<(Vec<u8>, Vec<u8>)> {
pub fn fetch_bootloaders<S: AsRef<str>>(config: &Config, cookbook: Option<S>, live: bool) -> Result<(Vec<u8>, Vec<u8>)> {
//TODO: make it safe to run this concurrently
let bootloader_dir = "/tmp/redox_installer_bootloader";
if Path::new(bootloader_dir).exists() {
......@@ -344,6 +344,7 @@ pub fn fetch_bootloaders<S: AsRef<str>>(cookbook: Option<S>, live: bool) -> Resu
fs::create_dir(bootloader_dir)?;
let mut bootloader_config = Config::default();
bootloader_config.general = config.general.clone();
bootloader_config.packages.insert("bootloader".to_string(), PackageConfig::default());
install_packages(&bootloader_config, bootloader_dir, cookbook.as_ref());
......@@ -538,7 +539,7 @@ pub fn install<P, S>(config: Config, output: P, cookbook: Option<S>, live: bool)
if output.as_ref().is_dir() {
install_dir(config, output, cookbook)
} else {
let (bootloader_bios, bootloader_efi) = fetch_bootloaders(cookbook.as_ref(), live)?;
let (bootloader_bios, bootloader_efi) = fetch_bootloaders(&config, cookbook.as_ref(), live)?;
with_whole_disk(output, &bootloader_bios, &bootloader_efi, None,
move |mount_path| {
install_dir(config, mount_path, cookbook)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment