init: Introduce UnitStore

This will be necessary to store persistent information about units like
if they are currently started and which process is associated with them.
This commit is contained in:
bjorn3
2026-02-25 22:06:25 +01:00
parent 73cc0b0a07
commit 6fcb07e7dd
7 changed files with 179 additions and 77 deletions
+1 -14
View File
@@ -37,7 +37,7 @@ impl Script {
}
}
#[derive(Debug)]
#[derive(Clone, Debug)]
pub enum Command {
// Service
Service(Service),
@@ -47,7 +47,6 @@ pub enum Command {
// Misc
Echo(String),
SwitchRoot(PathBuf, PathBuf),
Nothing,
}
@@ -59,18 +58,6 @@ impl Command {
match cmd.as_str() {
"echo" => Ok(Command::Echo(args.collect::<Vec<_>>().join(" "))),
"switchroot" => {
let Some(prefix) = args.next() else {
return Err("init: failed to switchroot: no argument".to_owned());
};
let Some(etcdir) = args.next() else {
return Err("init: failed to switchroot: missing etcdir".to_owned());
};
Ok(Command::SwitchRoot(
PathBuf::from(prefix),
PathBuf::from(etcdir),
))
}
"stdio" => {
let Some(stdio) = args.next() else {
return Err("init: failed to set stdio: no argument".to_owned());