kornelski / cargo-deb

Make Debian packages directly from Rust/Cargo projects
https://lib.rs/cargo-deb
MIT License
431 stars 52 forks source link

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

Open akilangh opened 2 weeks ago

akilangh commented 2 weeks ago

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 commented 1 week ago

Yes, please submit a PR