diff --git a/openssh.changes b/openssh.changes index d35b282..d58c5f3 100644 --- a/openssh.changes +++ b/openssh.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jan 22 02:54:02 UTC 2021 - Hans Petter Jansson + +- Make sure sshd is enabled correctly when upgrading from a + pre-systemd distribution (bsc#1180083). + ------------------------------------------------------------------- Mon Jan 18 00:30:37 UTC 2021 - Dirk Müller diff --git a/openssh.spec b/openssh.spec index e572352..6f1eca9 100644 --- a/openssh.spec +++ b/openssh.spec @@ -346,9 +346,12 @@ done # %%service_add_post scriptlet (in %%post server) will see it as a new service # and apply the preset, disabling it. We need to reenable it afterwards if # necessary. +mkdir -p %{_tmpenableddir} || : if [ -x %{_bindir}/systemctl ]; then - mkdir -p %{_tmpenableddir} || : %{_bindir}/systemctl is-enabled sshd > %{_tmpenabledfile} || : +else + if [ x$(find %{_sysconfdir}/init.d/rc[35].d -name 'S*' -type l -exec readlink -f {} \; | grep sshd$ | uniq) \ + == x%{_sysconfdir}/init.d/sshd ]; then echo "enabled" > %{_tmpenabledfile} || :; fi fi %pre server @@ -361,9 +364,12 @@ test -f /etc/pam.d/sshd.rpmsave && mv -v /etc/pam.d/sshd.rpmsave /etc/pam.d/sshd # See %%pre. +mkdir -p %{_tmpenableddir} || : if [ -x %{_bindir}/systemctl ]; then - mkdir -p %{_tmpenableddir} || : %{_bindir}/systemctl is-enabled sshd > %{_tmpenabledfile} || : +else + if [ x$(find %{_sysconfdir}/init.d/rc[35].d -name 'S*' -type l -exec readlink -f {} \; | grep sshd$ | uniq) \ + == x%{_sysconfdir}/init.d/sshd ]; then echo "enabled" > %{_tmpenabledfile} || :; fi fi %service_add_pre sshd.service