summaryrefslogtreecommitdiff
path: root/init/src/main.rs
diff options
context:
space:
mode:
authornamilsk <namilsk@namilsk.tech>2026-01-31 21:26:26 +0300
committernamilsk <namilsk@namilsk.tech>2026-01-31 21:26:26 +0300
commita5749a5d8d38b0db2ce5548473f8a61b674578a6 (patch)
treefe9227f4b40345a2730ce9373c740787e7ca5506 /init/src/main.rs
parentb81a55bea1525b2fcf84591eb902926fb1d0cece (diff)
Started writing service-utils and adding docstrings
Diffstat (limited to 'init/src/main.rs')
-rw-r--r--init/src/main.rs15
1 files changed, 11 insertions, 4 deletions
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<Runlevel> = Mutex::new(Runlevel::Undefined);
+
fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Initializing your system.");
if let Err(e) = check_pid() {
@@ -62,13 +69,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
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(())
}