kornelski / cargo-deb

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

Adding ability to specify multiple systemd unit files #65

Closed noyez closed 1 year ago

noyez commented 1 year ago

This adds the ability to specify multiple unit files for the debian package with the following syntax:

[package.metadata.deb]
systemd-units=[ { unit-name = "unit-script-1", unit-scripts = "debian/", enable = true },
                { unit-name = "unit-script-2", unit-scripts = "debian/", enable = true } ]

This is intended address issue: #42. This worked for my use-case, it passed cargo test. I'm not sure what other tests are needed. It works by making CargoDeb::systemd_units from an Option<SystemdUnitsConfig>' to anOption<Vec>` and everything else mostly fell into place thanks to the rust type system.

kornelski commented 1 year ago

Thanks. It also needs to be documented.

noyez commented 1 year ago

Thanks. It also needs to be documented.

You mean an updated https://github.com/kornelski/cargo-deb/blob/main/systemd.md? I'll open another PR for that.

kornelski commented 1 year ago

Unfortunately, this is not backwards-compatible: 9acaaa22d260855a824fd26456877b1b650de178

Can you change the serde definition in CargoDeb to take an enum that is either one unit or a vec?

noyez commented 1 year ago

Ahh yes, i know exactly what you mean. I can do this.