From 480ac8c5ec205dc812c155b8f52a63ff9360889429624354abf814716e80874e Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Fri, 10 Feb 2023 13:08:12 +0000 Subject: [PATCH] Accepting request 1063688 from home:schubi2:pam_usr_etc - Migration of PAM settings to /usr/lib/pam.d. OBS-URL: https://build.opensuse.org/request/show/1063688 OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:cockpit/cockpit?expand=0&rev=122 --- cockpit.changes | 5 +++++ cockpit.spec | 30 +++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/cockpit.changes b/cockpit.changes index dcce8f6..0b1567e 100644 --- a/cockpit.changes +++ b/cockpit.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Feb 7 15:47:35 UTC 2023 - Stefan Schubert + +- Migration of PAM settings to /usr/lib/pam.d. + ------------------------------------------------------------------- Wed Jan 25 11:13:36 UTC 2023 - Luna D Dragon diff --git a/cockpit.spec b/cockpit.spec index 1cfb9e6..52d55f4 100644 --- a/cockpit.spec +++ b/cockpit.spec @@ -230,8 +230,13 @@ make -j$(nproc) check # In obs we get write error: stdout %make_install | tee make_install.log make install-tests DESTDIR=%{buildroot} +%if 0%{?suse_version} > 1500 +mkdir -p $RPM_BUILD_ROOT%{_pam_vendordir} +install -p -m 644 tools/cockpit.pam $RPM_BUILD_ROOT%{_pam_vendordir}/cockpit +%else mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/pam.d install -p -m 644 tools/cockpit.pam $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/cockpit +%endif rm -f %{buildroot}/%{_libdir}/cockpit/*.so install -D -p -m 644 AUTHORS COPYING README.md %{buildroot}%{_docdir}/cockpit/ @@ -322,7 +327,12 @@ done for libexec in cockpit-askpass cockpit-session cockpit-ws cockpit-tls cockpit-wsinstance-factory cockpit-client cockpit-client.ui cockpit-desktop cockpit-certificate-helper cockpit-certificate-ensure; do rm %{buildroot}/%{_libexecdir}/$libexec done -rm -r %{buildroot}/%{_libdir}/security %{buildroot}/%{_sysconfdir}/pam.d %{buildroot}/%{_sysconfdir}/motd.d %{buildroot}/%{_sysconfdir}/issue.d +rm -r %{buildroot}/%{_libdir}/security %{buildroot}/%{_sysconfdir}/motd.d %{buildroot}/%{_sysconfdir}/issue.d +%if 0%{?suse_version} > 1500 +rm -r %{buildroot}/%{_pam_vendordir} +%else +rm -r %{buildroot}/%{_sysconfdir}/pam.d +%endif rm %{buildroot}/usr/bin/cockpit-bridge rm -f %{buildroot}%{_libexecdir}/cockpit-ssh rm -f %{buildroot}%{_datadir}/metainfo/cockpit.appdata.xml @@ -510,7 +520,11 @@ authentication via sssd/FreeIPA. %doc %{_mandir}/man8/pam_ssh_add.8.gz %dir %{_sysconfdir}/cockpit %config(noreplace) %{_sysconfdir}/cockpit/ws-certs.d +%if 0%{?suse_version} > 1500 +%{_pam_vendordir}/cockpit +%else %config(noreplace) %{_sysconfdir}/pam.d/cockpit +%endif # dir is not owned by pam in openSUSE %dir %{_sysconfdir}/motd.d # created in %post, so that users can rm the files @@ -558,6 +572,12 @@ getent passwd cockpit-wsinstance >/dev/null || useradd -r -g cockpit-wsinstance if %{_sbindir}/selinuxenabled 2>/dev/null; then %selinux_relabel_pre -s %{selinuxtype} fi +%if 0%{?suse_version} > 1500 +# Prepare for migration to /usr/lib; save any old .rpmsave +for i in pam.d/cockpit ; do + test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i}.rpmsave.old ||: +done +%endif %post ws if [ -x %{_sbindir}/selinuxenabled ]; then @@ -608,6 +628,14 @@ fi %verify_permissions -e %{_libexecdir}/cockpit-session %endif +%if 0%{?suse_version} > 1500 +%posttrans ws +# Migration to /usr/lib, restore just created .rpmsave +for i in pam.d/cockpit ; do + test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} ||: +done +%endif + # ------------------------------------------------------------------------------- # Sub-packages that are part of cockpit-system in RHEL/CentOS, but separate in Fedora