From a5749a5d8d38b0db2ce5548473f8a61b674578a6 Mon Sep 17 00:00:00 2001 From: namilsk Date: Sat, 31 Jan 2026 21:26:26 +0300 Subject: Started writing service-utils and adding docstrings --- init/src/main.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'init/src/main.rs') diff --git a/init/src/main.rs b/init/src/main.rs index a727b42..40e47a4 100644 --- a/init/src/main.rs +++ b/init/src/main.rs @@ -4,7 +4,8 @@ mod log; mod mounts; mod pid_one; mod processes; -mod signals; +mod signals; +mod services; use crate::host::locale; use crate::host::set::set_hostname; @@ -14,11 +15,17 @@ use crate::mounts::fstab::FstabEntry; use crate::mounts::rescue; use crate::pid_one::check_pid; use crate::processes::udev::spawn_udev; +use crate::services::unit_parser::Runlevel; use crate::signals::sigchld; // RULE: I will not use .expect() and .unwrap() in this project. This causes panic, // which will affect stability. +use std::sync::Mutex; + +/// Variable which show current runlevel; +pub static mut RUNLEVEL_STATE: Mutex = Mutex::new(Runlevel::Undefined); + fn main() -> Result<(), Box> { println!("Initializing your system."); if let Err(e) = check_pid() { @@ -62,13 +69,13 @@ fn main() -> Result<(), Box> { Err(e) => log_critical_error(&format!("Something went wrong while spawning udev: {}", e)), } - // TODO: Locale & tz parsing + // TODO: Locale & tz parsing match locale::set_system_localization(None, None) { Ok(_) => log_success("Localization (timezone and locale) set successfully."), Err(e) => log_warning(&format!("Failed to set localization: {}", e)), } - let _ = sigchld::setup_sigchld_handler(); - + let _ = sigchld::setup_sigchld_handler(); + Ok(()) } -- cgit v1.2.3