On Sun, Apr 7, 2024 at 4:24 PM Johannes Kastl <mail@johannes-kastl.de> wrote:
Hi all,

while working on Hashicorp Vault and OpenBao packages (stay tuned,
mail to Factory will come soon) I stumbled upon something I did not
have to do for quite a while. Hence my question what the current
practice is on that.

1. How should I handle files in /etc/openbao that should "belong" to
the package, but should not be packaged at all (the admin needs to
create that herself)?
Not having the file in the package means that querying RPM will not
yield which package this file belongs to. Of course, the directory
name might give a hint, but I would like to have rpm answer that
question properly.
My most educated guess whould be to %ghost those files. Not sure if
that is the right way]tm]. :-)

%ghost entries are the worst you can do. I know here are several people who think files created by an admin should belong to a package, but: since RPM does not know anything about this file and if it got modified or not, making package changes here later is impossible. We have enough packages which suffer from this.
So: don't use %ghost entries if not absolutely necessary.
And: if the admin creates the file, it does not belong to the RPM! So don't create the wrong impression that this config file does belong to a RPM if it does not.
Third: no RPM should install  or own files in /etc, this includes %ghost. See https://en.opensuse.org/openSUSE:Packaging_UsrEtc I updated that page now with upstream references.
 
2. How to treat example configuration files? Files that are not used
and thus can be safely overwritten by package upgrades

As somebody wrote already: mark them as %doc.
 
  Thorsten

--
Thorsten Kukuk, Distinguished Engineer, Senior Architect, Future Technologies
SUSE Software Solutions Germany GmbH, Frankenstraße 146, 90461 Nuernberg, Germany
Managing Director: Ivo Totev, Andrew McDonald, Werner Knoblich (HRB 36809, AG Nürnberg)