Install sane driver via /etc/sane.d/dll.d/hpaio instead of post-script hacks

This commit is contained in:
Andrey Bondrov 2017-02-21 01:03:23 +10:00
parent 68893be480
commit 8c6e20dde6

View file

@ -20,7 +20,7 @@
Summary: HP printer/all-in-one driver infrastructure
Name: hplip
Version: 3.16.11
Release: 2
Release: 3
License: GPLv2+ and MIT
Group: System/Printing
Url: http://hplip.sourceforge.net/
@ -98,7 +98,6 @@ BuildRequires: python3-cups
%if %{sane_backend}
BuildRequires: pkgconfig(sane-backends)
BuildRequires: xsane
Requires(post): hplip
%endif
Requires(post): systemd
Requires: cups
@ -205,7 +204,6 @@ the "%{libhpip}" library.
%package -n %{libsane}
Summary: SANE driver for scanners in HP's multi-function devices (from HPLIP)
Group: System/Printing
Requires(post): sane-backends
Provides: sane-backends-hpaio = %{version}-%{release}
# (cjw) for system-config-printer
Provides: libsane-hpaio = %{version}-%{release}
@ -544,6 +542,8 @@ mv %{buildroot}%{_docdir}/%{name}-%{version}%{extraversion} %{buildroot}%{_docdi
# Remove static libraries of SANE driver
rm -f %{buildroot}%{_libdir}/sane/libsane-hpaio*.la
rm -f %{buildroot}%{_sysconfdir}/sane.d/dll.conf
mkdir -p %{buildroot}%{_sysconfdir}/sane.d/dll.d
echo 'hpaio' > %{buildroot}%{_sysconfdir}/sane.d/dll.d/hpaio
# Remove other unneeded/unwanted files
# Remove files we don't want to package.
@ -681,27 +681,6 @@ done
/sbin/udevadm settle --timeout=15
:
%if %{sane_backend}
%post -n %{libsane}
# Add HPLIP driver to /etc/sane.d/dll.conf
if ! grep ^hpaio /etc/sane.d/dll.conf >/dev/null 2>/dev/null ; then \
echo hpaio >> /etc/sane.d/dll.conf; \
fi
%endif
%if %{sane_backend}
%preun -n %{libsane}
# Remove HPLIP driver from /etc/sane.d/dll.conf
if [ "$1" = 0 ]; then \
if grep ^hpaio /etc/sane.d/dll.conf >/dev/null 2>/dev/null ; then \
sed '/hpaio/d' /etc/sane.d/dll.conf > /tmp/$$; \
cp -f /tmp/$$ /etc/sane.d/dll.conf; \
rm -f /tmp/$$; \
fi; \
fi
%endif
# Restart CUPS to make the removal of the Fax PPD known to it
%_post_service cups
@ -853,9 +832,13 @@ fi
%{_libdir}/libhpdiscovery.so
%if %{sane_backend}
%{_libdir}/sane/libsane-hpaio.so
%endif
%if %{sane_backend}
%files -n %{libsane}
%{_libdir}/sane/libsane-hpaio.so.%{sanemaj}*
# Not really a shared library package so it's OK to have config here
%config(noreplace) %{_sysconfdir}/sane.d/dll.d/hpaio
%endif
%files compat-libs