Improve setup process (#596)

* Use error and warning for late boot messages

* Remove diskless mode message

* Add option to install system in memory
This commit is contained in:
Vincent Ollivier 2024-03-13 19:09:36 +01:00 committed by GitHub
parent f29b7b1f9f
commit 4922b2efa8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 6 deletions

View File

@ -5,7 +5,9 @@ extern crate alloc;
use bootloader::{entry_point, BootInfo};
use core::panic::PanicInfo;
use moros::{debug, hlt_loop, print, println, sys, usr};
use moros::{
debug, error, warning, hlt_loop, eprint, eprintln, print, println, sys, usr
};
entry_point!(main);
@ -30,11 +32,10 @@ fn user_boot() {
usr::shell::main(&["shell", script]).ok();
} else {
if sys::fs::is_mounted() {
println!("Could not find '{}'", script);
error!("Could not find '{}'", script);
} else {
println!("MFS not found, run 'install' to setup the system");
warning!("MFS not found, run 'install' to setup the system");
}
println!("Running console in diskless mode");
usr::shell::main(&["shell"]).ok();
}
}

View File

@ -299,12 +299,17 @@ pub fn main(args: &[&str]) -> Result<(), ExitCode> {
if !sys::fs::is_mounted() {
println!("{}Listing disks ...{}", csi_color, csi_reset);
usr::shell::exec("disk list").ok();
println!("/dev/mem RAM DISK");
println!();
println!("{}Formatting disk ...{}", csi_color, csi_reset);
print!("Enter path of disk to format: ");
let pathname = io::stdin().read_line();
usr::shell::exec(&format!("disk format {}", pathname.trim_end()))?;
let path = io::stdin().read_line();
if path.trim_end() == "/dev/mem" {
usr::shell::exec(&format!("memory format"))?;
} else {
usr::shell::exec(&format!("disk format {}", path.trim_end()))?;
}
println!();
}