systemd drop-in files directory

Hi all!
I writing specfile for rpm package which also shipping drop-in files for systemd units. According, Systemd unit files, including but not limited to service, socket, timer and path files should always be installed in %_unitdir, i.e. /usr/lib/systemd/system, and never in /etc/systemd/system. In this document there is a section Shipping unit file drop-ins, which regulates the naming policy of these files. But I confused with install path for drop-in files. I mark my conf files as %config(noreplace) because don’t want lost changes while upgrade package and If I install it to the %_unitdir/unitname.service.d I receive a warning non-etc-or-var-file-marked-as-conffile. If I install they into /etc/systemd/system/unitname.service.d** - get another warnings: suse-filelist-forbidden-systemd-userdirs **and **systemd-unit-in-etc.
**How would it be right to do this?

I normally look at the files down in the %{_unitdir) and have a look on OBS how it’s done…

Quick example here:

Thank you for your example, malcolm](, but systemd-swap package not contain drop-in file at all - you are remove it in %install section:

#Forbidden location so lets remove and let the user configure!
rm %{buildroot}%{_sysconfdir}/systemd/swap.conf

But I want to shipping it. Most likely it would be more correct to install confs in /etc/systemd/system, because /usr prefix must be able to set read-only. rpmlint warnings can be ignored, but it is not my way)
Another way is install drop-in files by pre/post scripts. But in this case I need to implement own %config(noreplace) in scripts. I don’t want reinventing the wheel…
In my current openSUSE installation only btrfsmaintenance package have drop-in files in /etc/systemd/system and even they are not part of rpm, but created install-time by post script. Instead a /usr/lib/systemd/system directory have a some drop-in files in the appropriate directories - nfs-client, suse-module-tools, NetworkManager… In some cases those drop-in files creates dynamically during installation and other copied with no changes from the source. But always they are a part of package and listed in %files section (not like %config) and they probably aren’t meant for manual editing. Maybe there are more suitable examples in OBS, but I do not know how to find them…

Any systemd files installed by rpm go into %{_unitdir}, or use /usr/etc for your config files. Local admin files are installed in /etc

Users are not supposed to edit files under /usr/lib/systemd.

How would it be right to do this?

You install your files in /usr/lib/systemd and users override them in /etc.