From 4ee948ea41020b80b773509890f6631fd4960004 Mon Sep 17 00:00:00 2001 From: namilsk Date: Wed, 31 Dec 2025 23:09:33 +0300 Subject: Added logs annotation to `README.md` --- .vscode/launch.json | 58 +++++++++++++++++++++++++++++++++++++++++++++++ README.md | 42 +++++++++++++++++++--------------- init/src/main.rs | 2 +- init/src/mounts/fstab.rs | 13 ++++++----- init/src/mounts/mod.rs | 4 ++-- init/src/mounts/rescue.rs | 2 +- init/src/pid_one.rs | 2 +- 7 files changed, 94 insertions(+), 29 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..2519d97 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,58 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Debug executable 'init'", + "type": "lldb", + "request": "launch", + "cargo": { + "args": [ + "run", + "--bin=init", + "--package=init" + ] + }, + "args": [] + }, + { + "name": "Debug unit tests in executable 'init'", + "type": "lldb", + "request": "launch", + "cargo": { + "args": [ + "test", + "--bin=init", + "--package=init" + ] + } + }, + { + "name": "Debug executable 'vegilctl'", + "type": "lldb", + "request": "launch", + "cargo": { + "args": [ + "run", + "--bin=vegilctl", + "--package=vegilctl" + ] + }, + "args": [] + }, + { + "name": "Debug unit tests in executable 'vegilctl'", + "type": "lldb", + "request": "launch", + "cargo": { + "args": [ + "test", + "--bin=vegilctl", + "--package=vegilctl" + ] + } + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md index eb1b156..820e3dd 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,24 @@ -# Vigil -Vigil is an init system (PID 1) developed for the Antrhill distribution and licensed under GPL2.0-only. - -The development is based on the Unix philosophy: -- **"Make each program do one thing well."** - - Doug McIlroy - -- **"Write programs that do one thing and do it well. Write programs to work together."** - - Peter H. Salus, summarizing Unix philosophy - -- **"The UNIX system is characterized by: [...] A unified view of I/O, and a hierarchical file system. A small number of kernel primitives, augmented by a rich set of user-level tools."** - - Ritchie & Thompson, «The UNIX Time-Sharing System» - -`vegil` strives to be indestructible, something that even in the case of most errors will boot you into the system. If not, then go to rescue mode with all the tools installed. - -# Development -This repo contains the source code of the `init` executable itself and `vegilctl`, for managing the initialization system. -At the moment, the init binary itself is a priority for development. \ No newline at end of file +# Vigil +Vigil is an init system (PID 1) developed for the Antrhill distribution and licensed under GPL2.0-only. + +The development is based on the Unix philosophy: +- **"Make each program do one thing well."** + - Doug McIlroy + +- **"Write programs that do one thing and do it well. Write programs to work together."** + - Peter H. Salus, summarizing Unix philosophy + +- **"The UNIX system is characterized by: [...] A unified view of I/O, and a hierarchical file system. A small number of kernel primitives, augmented by a rich set of user-level tools."** + - Ritchie & Thompson, «The UNIX Time-Sharing System» + +`vegil` strives to be indestructible, something that even in the case of most errors will boot you into the system. If not, then go to rescue mode with all the tools installed. + +# Development +This repo contains the source code of the `init` executable itself and `vegilctl`, for managing the initialization system. +At the moment, the init binary itself is a priority for development. + +# Usage +All operations are logged and start with `*` and looks like `* `, it has three colors: +- Red (`\x1b[31m`) - This means that a mission-critical operation has failed, and you will most likely go into rescue mode. +- Yellow (`\x1b[33m`) - It means that the operation specified by the user in the configuration or not critical has failed, the system will start, but it is better to pay attention to this. +- Green (`\x1b[32m`) - Everything is in order. \ No newline at end of file diff --git a/init/src/main.rs b/init/src/main.rs index bfcef87..1138ccf 100644 --- a/init/src/main.rs +++ b/init/src/main.rs @@ -5,6 +5,6 @@ use crate::pid_one::check_pid; fn main() -> Result<(), Box> { println!("Initializing your system."); - check_pid().expect("Runned not as PID 1."); + check_pid().expect("\x1b[31m * \x1b[0m Runned not as first process. init/src/pid_one.rs:8:8"); Ok(()) } diff --git a/init/src/mounts/fstab.rs b/init/src/mounts/fstab.rs index 4c43eac..0765cfd 100644 --- a/init/src/mounts/fstab.rs +++ b/init/src/mounts/fstab.rs @@ -47,9 +47,6 @@ fn parse_mount_options( Ok((flags, data)) } - - - pub fn mount_from_fstab(entries: &[FstabEntry]) -> Result<(), Box> { for entry in entries { if entry.fstype == "swap" { @@ -62,7 +59,7 @@ pub fn mount_from_fstab(entries: &[FstabEntry]) -> Result<(), Box Result<(), Box Result<(), Box> { ) .into()); } - println!("\x1b[32m * \x1b[0m Mounting {}...", target ); + println!("\x1b[32m * \x1b[0m Mounting {}...", target); } } diff --git a/init/src/pid_one.rs b/init/src/pid_one.rs index 84cca47..e4034ad 100644 --- a/init/src/pid_one.rs +++ b/init/src/pid_one.rs @@ -5,6 +5,6 @@ pub fn check_pid() -> Result<(), Box> { match pid { 1 => Ok(()), - _ => Err("Runned not as first process.".into()), + _ => Err(format!("Current PID: {}", pid).into()), } } -- cgit v1.2.3