I want to build an RPM that I can use to replace existing files on a host to authenticate against LDAP. I'm painfully aware of the fact that I can do the same with a bash script, puppet, etc.
Here is what I have:
Code:
%prep
# no setup
%build
# no building
%install
#rm -rf $RPM_BUILD_ROOT
install -Dp -dm 644 ${RPM_BUILD_ROOT}%{_sysconfdir}/ldap.conf
install -Dp -dm 644 ${RPM_BUILD_ROOT}%{_sysconfdir}/openldap/ldap.conf
install -Dp -dm 644 ${RPM_BUILD_ROOT}%{_sysconfdir}/pam.d/system-auth
install -Dp -dm 644 ${RPM_BUILD_ROOT}%{_sysconfdir}/nsswitch.conf
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%config %{_sysconfdir}/openldap/ldap.conf
%config %{_sysconfdir}/ldap.conf
%config %{_sysconfdir}/pam.d/system-auth
%config %{_sysconfdir}/nsswitch.conf
This does not work because it conflicts with file from existing OS package (e.g. Glibc, openldap, etc.). Is there a way to safely backup the existing files, and then replace them with my own?
Should I be using the Patch method instead?