init: Special case logd
Logd is a special case. Every other service effectively has an implicit dependency on it for sending log messages to it and even init itself depends on it for it's own log messages.
This commit is contained in:
+7
-5
@@ -135,11 +135,6 @@ fn run_command(cmd: Command, config: &mut InitConfig) {
|
||||
Command::RequiresWeak(_) => {} // handled by unit parsing code
|
||||
Command::Nothing => {}
|
||||
Command::Echo(text) => println!("{text}"),
|
||||
Command::Stdio(stdio) => {
|
||||
if let Err(err) = switch_stdio(&stdio) {
|
||||
eprintln!("init: failed to switch stdio to '{}': {}", stdio, err);
|
||||
}
|
||||
}
|
||||
Command::Service(service) => {
|
||||
if config.skip_cmd.contains(&service.cmd) {
|
||||
eprintln!(
|
||||
@@ -166,6 +161,13 @@ fn main() {
|
||||
}
|
||||
.apply(&mut pending_units, &mut unit_store, &mut init_config);
|
||||
|
||||
let mut command = std::process::Command::new("logd");
|
||||
command.env_clear().envs(&init_config.envs);
|
||||
daemon::SchemeDaemon::spawn(command, "log");
|
||||
if let Err(err) = switch_stdio("/scheme/log") {
|
||||
eprintln!("init: failed to switch stdio to '/scheme/log': {err}");
|
||||
}
|
||||
|
||||
let runtime_target = UnitId("00_runtime.target".to_owned());
|
||||
|
||||
'a: while let Some(unit) = pending_units.pop_front() {
|
||||
|
||||
@@ -45,9 +45,6 @@ pub enum Command {
|
||||
// Service
|
||||
Service(Service),
|
||||
|
||||
// Modify env
|
||||
Stdio(String),
|
||||
|
||||
// Misc
|
||||
Echo(String),
|
||||
Nothing,
|
||||
@@ -62,12 +59,6 @@ impl Command {
|
||||
match cmd.as_str() {
|
||||
"requires_weak" => Ok(Command::RequiresWeak(args.map(UnitId).collect::<Vec<_>>())),
|
||||
"echo" => Ok(Command::Echo(args.collect::<Vec<_>>().join(" "))),
|
||||
"stdio" => {
|
||||
let Some(stdio) = args.next() else {
|
||||
return Err("init: failed to set stdio: no argument".to_owned());
|
||||
};
|
||||
Ok(Command::Stdio(stdio))
|
||||
}
|
||||
"notify" => {
|
||||
let process = Process::parse(args)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user