I have a custom RPM I created that needs to add entries to sudoers so I have entries added a file in my RPM /etc/sudoers.d/mypackage
and put my sudo commands in there.
The files gets added and the RPM is generated. Unfortunately, when I try to install the package, it complains:
file /etc/sudoers.d from install of mypackage-1.0.0-1.x86_64 conflicts with file from sudo-1.8.6p7016.el7.x86_64
The rpm will install fine if I install it with --force such as:
rpm -Uvh --force mypackage.rpm
I probably could echo the contents of the sudoers file into /etc/sudoers.d
but I would prefer the sudoers file be tracked with the rpm.
How do I add entries to sudoers from a custom RPM without sudo complaining?
EDIT: To clarify my post a bit, I have a dozen directories filled with files:
/etc/sudoers.d
/etc/httpd/conf.d/
/etc/systemd/system
/etc/cron.d
...
Because I don't have beforehand the list of directories and this list may change, I tried to do is:
%files
/etc/*
%exclude /etc/sudoers.d
/etc/sudoers.d/*
but at that point, files in sudoers.d don't get included. If I wanted to mention directories, one by one, I would have to dynamically generate that list of directories
As was suggested, I tried to do rpm -qf /etc/sudoers.d
and it does say sudo-1.8.5.el7_2.x86_64
. If I do rpm -qf /etc/systemd/system
, it does say systemd-219-19.el7_2.x86_64
but rpm does not complain when I try to install the rpm