mod mounts; mod pid_one; use crate::mounts::fstab::FstabEntry; use crate::mounts::rescue; use crate::pid_one::check_pid; // RULE: I will not use .expect() and .unwrap() in this project. This causes panic, // which will affect stability. fn main() -> Result<(), Box> { println!("Initializing your system."); check_pid().expect("\x1b[31m * \x1b[0m Runned not as first process. init/src/pid_one.rs:8:8"); match FstabEntry::parse_fstab("/etc/fstab") { Ok(entries) => { println!("\x1b[32m * \x1b[0m Sucessfully parsed /etc/fstab."); for entry in &entries { let _ = entry.mount(); } }, Err(error) => { println!("\x1b[33m * \x1b[0m Looks like fstab broken. Mounting all without reading /etc/fstab."); println!("\x1b[33m * \x1b[0m Error:\n {}", error); let _ = rescue::mount_system(); // Minimal mounts without fstab, because /etc/fstab needs fixes :) // Btw it should be used if fstab broken or has syntax-errors // TODO: If fstab contains syntax errors, mount everything else that does not contain them through it anyway. } } Ok(()) }