From df5f0671abdfa2ac5cb05bf03127489081789a967704040d3f8f11b9f30c67a4 Mon Sep 17 00:00:00 2001 From: Martin Wilck Date: Mon, 13 Jan 2020 22:34:02 +0000 Subject: [PATCH] Accepting request 764140 from home:mwilck:branches:Printing - Use /etc/sane.d/dll.d/hpaio to register SANE backend rather than modifying /etc/sane/dll.conf - SANE backend must be configured in hplip-sane package (bsc#1160708) OBS-URL: https://build.opensuse.org/request/show/764140 OBS-URL: https://build.opensuse.org/package/show/Printing/hplip?expand=0&rev=189 --- hplip.changes | 7 +++++++ hplip.spec | 37 +++++++++++-------------------------- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/hplip.changes b/hplip.changes index 16c239d..f3bd971 100644 --- a/hplip.changes +++ b/hplip.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Jan 13 22:01:08 UTC 2020 - Martin Wilck + +- Use /etc/sane.d/dll.d/hpaio to register SANE backend rather + than modifying /etc/sane/dll.conf +- SANE backend must be configured in hplip-sane package (bsc#1160708) + ------------------------------------------------------------------- Mon Jan 13 17:27:20 UTC 2020 - Martin Wilck diff --git a/hplip.spec b/hplip.spec index 8172424..5f53147 100644 --- a/hplip.spec +++ b/hplip.spec @@ -450,6 +450,8 @@ install -d %{buildroot}%{_localstatedir}/log/hp/tmp # Remove the installed /etc/sane.d/dll.conf # because this is provided by the sane-backends package: rm %{buildroot}%{_sysconfdir}/sane.d/dll.conf +mkdir %{buildroot}%{_sysconfdir}/sane.d/dll.d +echo hpaio >%{buildroot}%{_sysconfdir}/sane.d/dll.d/hpaio # Remove the installed HAL fdi file because HAL is no longer used (HAL is deprecated): rm %{buildroot}%{_datadir}/hal/fdi/preprobe/10osvendor/20-hplip-devices.fdi # Remove the installed hplip-printer@.service file for systemd @@ -581,38 +583,18 @@ install -m 644 %{SOURCE102} %{buildroot}%{_mandir}/man1/ /sbin/ldconfig exit 0 -%triggerin -p /bin/bash -- sane-backends -# As hplip can be used for plain printers it cannot "PreReq sane-backends". -# Therefore if sane-backends is installed it may be installed or updated after hplip. -# In this case trigger to add the SANE backend "hpaio" to /etc/sane.d/dll.conf if it is not there. -# To be safe there is a test that /etc/sane.d/dll.conf is writable. -if [ -w %{_sysconfdir}/sane.d/dll.conf ] -then if ! grep -q 'hpaio' %{_sysconfdir}/sane.d/dll.conf - then echo -e '# The hpaio backend is provided by the hplip package:\n#hpaio' >>%{_sysconfdir}/sane.d/dll.conf - fi -fi -exit 0 - %postun -p /bin/bash %desktop_database_postun %icon_theme_cache_postun /sbin/ldconfig + +%postun sane +# Earlier versions of hplip modified /etc/sane.d/dll.conf +# Now we use /etc/sane.d/dll.d (multiple hpaio entries don't hurt). # If the package was removed (but not if it was updated) # then remove the hpaio lines in /etc/sane.d/dll.conf. -# Don't remove them when the hplip package was automatically -# replaced by the hplip17 package (via RPM obsoletes) or vice versa. -# Because postun of the old package runs last (after triggerin -- sane-backends) -# it is done via a special "ls" test if any libsane-hpaio.so exists -# (e.g. there could be only 32-bit installed on 64-bit hardware). -# If the "ls" test does not fail, some kind of HPLIP is installed. -# The package sane-backends may not be installed (see triggerin) -# and therefore the test that /etc/sane.d/dll.conf is writable. -# The "exit 0" is necessary, otherwise the postun script -# would exit with non-zero exit-code if the package was not removed. -if [ "$1" = "0" ] -then if ! ls %{_prefix}/lib*/sane/libsane-hpaio.so* &>/dev/null - then [ -w %{_sysconfdir}/sane.d/dll.conf ] && sed -i -e '/hpaio/d' %{_sysconfdir}/sane.d/dll.conf - fi +if [ "$1" = "0" ] && [ -w %{_sysconfdir}/sane.d/dll.conf ]; then + sed -i -e '/hpaio/d' %{_sysconfdir}/sane.d/dll.conf fi exit 0 @@ -743,6 +725,9 @@ exit 0 %files sane %dir %{_libdir}/sane %{_libdir}/sane/libsane-hpaio.so.* +%dir %{_sysconfdir}/sane.d +%dir %{_sysconfdir}/sane.d/dll.d +%{_sysconfdir}/sane.d/dll.d/hpaio %files devel %{_libdir}/libhpip.so