-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default to systemd, refer to documentation if systemd is not available #336
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,6 +75,13 @@ impl ConfigureInitService { | |
}, | ||
#[cfg(target_os = "linux")] | ||
InitSystem::Systemd => { | ||
// 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 | ||
if !(Path::new("/run/systemd/system").exists() || which::which("systemctl").is_ok()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Related to #392. On WSL without systemd running, the systemctl command does exist (Ubuntu 22.04.1 from the windows store). So this check would not error, even though systemd needs to be configured in Note that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for tracking this down! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be a case of a simple logic error, as in, the following would work: -if !(Path::new("/run/systemd/system").exists() || which::which("systemctl").is_ok())
---
+if (!Path::new("/run/systemd/system").exists() || !which::which("systemctl").is_ok()) Although I'm not sure what the original intention was |
||
{ | ||
return Err(ActionError::SystemdMissing); | ||
} | ||
|
||
Self::check_if_systemd_unit_exists(SERVICE_SRC, SERVICE_DEST).await?; | ||
Self::check_if_systemd_unit_exists(SOCKET_SRC, SOCKET_DEST).await?; | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this shouldn't be the second "use case", but somewhat lower?
But also I want this to be visible before the other below use cases that specify
--init none
... Could just add a link back in place of their "> When--init none
is..." notices.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your preference here. I think this is a fine location but am not picky!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Myeah, I think this is fine for now. We can always add more docs / more backlinking!