Improve WSL systemd detection (#469)
* Improve WSL systemd detection * Make systemd missing in wsl an expected error * fmt * Use && instead * Make it more verbose
This commit is contained in:
parent
eb41cc9205
commit
2673a9b299
|
@ -93,8 +93,11 @@ impl ConfigureInitService {
|
||||||
InitSystem::Systemd => {
|
InitSystem::Systemd => {
|
||||||
// If /run/systemd/system exists, we can be reasonably sure the machine is booted
|
// If /run/systemd/system exists, we can be reasonably sure the machine is booted
|
||||||
// with systemd: https://www.freedesktop.org/software/systemd/man/sd_booted.html
|
// with systemd: https://www.freedesktop.org/software/systemd/man/sd_booted.html
|
||||||
if !(Path::new("/run/systemd/system").exists() || which::which("systemctl").is_ok())
|
if !Path::new("/run/systemd/system").exists() {
|
||||||
{
|
return Err(Self::error(ActionErrorKind::SystemdMissing));
|
||||||
|
}
|
||||||
|
|
||||||
|
if which::which("systemctl").is_err() {
|
||||||
return Err(Self::error(ActionErrorKind::SystemdMissing));
|
return Err(Self::error(ActionErrorKind::SystemdMissing));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -568,6 +568,7 @@ impl HasExpectedErrors for ActionErrorKind {
|
||||||
Self::PathUserMismatch(_, _, _)
|
Self::PathUserMismatch(_, _, _)
|
||||||
| Self::PathGroupMismatch(_, _, _)
|
| Self::PathGroupMismatch(_, _, _)
|
||||||
| Self::PathModeMismatch(_, _, _) => Some(Box::new(self)),
|
| Self::PathModeMismatch(_, _, _) => Some(Box::new(self)),
|
||||||
|
Self::SystemdMissing => Some(Box::new(self)),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue