kornelski / cargo-deb

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

Files in /etc are overwritten #121

Closed datapythonista closed 4 months ago

datapythonista commented 10 months ago

My understanding when reading this doc linked in cargo-deb documentation for conf-files is that anything under /etc will automatically not be overwritten when a package is upgraded.

But given this Cargo.toml section:

[package.metadata.deb]
assets = [
    ["target/release/doc-previewer", "usr/bin/", "755"],
    ["config.toml", "etc/doc-previewer/", "644"],
]

And installing a new version of my package with sudo dpkg -i doc-previewer_0.1.1-1_amd64.deb, the config.toml configuration file is indeed overwritten by the new version one.

Also, after using the conf-files option like this:

conf-files = ["config.toml"]

or this:

conf-files = ["/etc/doc-previewer/config.toml"]

It will also overwrite the file.

Am I doing something wrong? Or is this not working as expected? I'm happy to open a PR to clarify the docs if it's something I'm doing wrong.

Thanks for the amazing work with this btw, I build .deb packages in the past, and I couldn't be happier that this tool exist. :)

kornelski commented 10 months ago

Files listed in assets are always overwriting.

datapythonista commented 10 months ago

Files listed in assets are always overwriting.

Thanks for the information. I tried removing the config file from assets and to add this but doesn't seem to work:

conf-files = [
    ["config.toml", "etc/doc-previewer/", "644"],
]

I don't understand how a configuration file that is not overwritten needs to be specified then.

kornelski commented 10 months ago

Sorry, I was mistaken. The file needs to be listed in assets, since conf-files won't imply inclusion. Unfortunately, I don't know why it's not behaving as expected.

datapythonista commented 10 months ago

Thank you for clarifying and for your help. Knowing that it is expected to preserve the config file when updating I'll have a look and try to understand where is the problem. I'll post here any finding. Thanks!

JakkuSakura commented 6 months ago

Please document conf-files properly. Which string should I put into conf-files???

Edit: figured out it should be target file path

kornelski commented 4 months ago

Now the conffiles is generated automatically for all assets in etc/