Skip to content
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

There should be a way to enable/disable start/not-start systemd unit files independently. #153

Open
akilangh opened this issue Nov 7, 2024 · 2 comments

Comments

@akilangh
Copy link

akilangh commented Nov 7, 2024

The documentation at https://github.com/kornelski/cargo-deb/blob/main/systemd.md has following snippet:

systemd-units = [ 
        { unit-name = "unit-one", enable = false },
        { unit-name = "unit-two", enable = false } 
    ] 

This seems to indicate that it is possible to enable or disable the unit file independently. That is the following configuration is possible:

systemd-units = [ 
        { unit-name = "unit-one", enable = true },
        { unit-name = "unit-two", enable = false } 
    ] 

In reality this is not possible. All units have common options. We need at least a documentation update.

Further it is a good feature to support individual options. This is especially desirable since cargo-deb adds snippets for all service files it finds in assets even if they are not mentioned in system-units, meaning there is no way to stop cargo-deb from generating snippets for a specific unit file if I don't want it to. My package has multiple unit files and only one of them need to be started post-install.

Thank you for looking into this. I can submit a patch if this is a feature you are willing to support.

@kornelski
Copy link
Owner

Yes, please submit a PR

@asasine
Copy link

asasine commented Nov 27, 2024

Another scenario where this makes sense is for timer+service unit pairs. Conventionally, only the timer is enabled, not the service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants