Skip to content
Snippets Groups Projects
Verified Commit e8e4687c authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Pass live argument from CLI to library

parent 1ecb9b49
No related branches found
No related tags found
No related merge requests found
...@@ -14,10 +14,11 @@ fn main() { ...@@ -14,10 +14,11 @@ fn main() {
let stderr = io::stderr(); let stderr = io::stderr();
let mut stderr = stderr.lock(); let mut stderr = stderr.lock();
let mut parser = ArgParser::new(3) let mut parser = ArgParser::new(4)
.add_opt("b", "cookbook") .add_opt("b", "cookbook")
.add_opt("c", "config") .add_opt("c", "config")
.add_flag(&["l", "list-packages"]); .add_flag(&["l", "list-packages"])
.add_flag(&["live"]);
parser.parse(env::args()); parser.parse(env::args());
let config = if let Some(path) = parser.get_opt("config") { let config = if let Some(path) = parser.get_opt("config") {
...@@ -68,7 +69,7 @@ fn main() { ...@@ -68,7 +69,7 @@ fn main() {
} }
} else { } else {
if let Some(path) = parser.args.get(0) { if let Some(path) = parser.args.get(0) {
if let Err(err) = redox_installer::install(config, path, cookbook) { if let Err(err) = redox_installer::install(config, path, cookbook, parser.found("live")) {
writeln!(stderr, "installer: failed to install: {}", err).unwrap(); writeln!(stderr, "installer: failed to install: {}", err).unwrap();
process::exit(1); process::exit(1);
} }
......
...@@ -525,7 +525,7 @@ pub fn with_whole_disk<P, F, T>(disk_path: P, bootloader_bios: &[u8], bootloader ...@@ -525,7 +525,7 @@ pub fn with_whole_disk<P, F, T>(disk_path: P, bootloader_bios: &[u8], bootloader
) )
} }
pub fn install<P, S>(config: Config, output: P, cookbook: Option<S>) pub fn install<P, S>(config: Config, output: P, cookbook: Option<S>, live: bool)
-> Result<()> where -> Result<()> where
P: AsRef<Path>, P: AsRef<Path>,
S: AsRef<str>, S: AsRef<str>,
...@@ -535,7 +535,7 @@ pub fn install<P, S>(config: Config, output: P, cookbook: Option<S>) ...@@ -535,7 +535,7 @@ pub fn install<P, S>(config: Config, output: P, cookbook: Option<S>)
if output.as_ref().is_dir() { if output.as_ref().is_dir() {
install_dir(config, output, cookbook) install_dir(config, output, cookbook)
} else { } else {
let (bootloader_bios, bootloader_efi) = fetch_bootloaders(cookbook.as_ref(), false)?; let (bootloader_bios, bootloader_efi) = fetch_bootloaders(cookbook.as_ref(), live)?;
with_whole_disk(output, &bootloader_bios, &bootloader_efi, None, with_whole_disk(output, &bootloader_bios, &bootloader_efi, None,
move |mount_path| { move |mount_path| {
install_dir(config, mount_path, cookbook) install_dir(config, mount_path, cookbook)
......
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