Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package sane-backends.15910 for
openSUSE:Leap:15.2:Update checked in at 2021-03-16 18:07:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2:Update/sane-backends.15910 (Old)
and /work/SRC/openSUSE:Leap:15.2:Update/.sane-backends.15910.new.2401
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sane-backends.15910"
Tue Mar 16 18:07:01 2021 rev:1 rq:878876 version:1.0.32
Changes:
--------
New Changes file:
--- /dev/null 2021-03-11 01:47:46.020784395 +0100
+++
/work/SRC/openSUSE:Leap:15.2:Update/.sane-backends.15910.new.2401/sane-backends.changes
2021-03-16 18:07:01.936134186 +0100
@@ -0,0 +1,2039 @@
+-------------------------------------------------------------------
+Mon Feb 22 15:20:11 CET 2021 - [email protected]
+
+- sane-backends version upgrade to 1.0.32 for SLE15:
+ * sane-backends version upgrade to 1.0.32
+ to fix bugs in sane-backends version 1.0.31 in particular
+ https://gitlab.com/sane-project/backends/-/issues/402
+ double height image with the avision backend (bsc#1179065)
+ to avoid regressions by hardware enablement for scanners
+ (jsc#SLE-15561 and jsc#SLE-15560 with jsc#ECO-2418)
+ cf. the entry below dated "Wed Oct 14 11:17:03 CEST 2020"
+
+-------------------------------------------------------------------
+Mon Feb 15 13:57:16 UTC 2021 - Stefan Br??ns <[email protected]>
+
+- Remove udev rules mangling for USB devices (ATTR vs ATTRS) (!510)
+- Do no add SCSI id twice for EPSON Perfection 1640SU (!509)
+
+-------------------------------------------------------------------
+Mon Feb 15 14:05:32 CET 2021 - [email protected]
+
+- Upgraded to sane-backends version 1.0.32
+ Changes since 1.0.31
+ see https://gitlab.com/sane-project/backends/-/blob/master/NEWS
+ Numbers of the form '(#NNN)' usually mean upstream issues like
+ https://gitlab.com/sane-project/backends/-/issues/NNN and numbers
+ of the form '(!MMM)' usually mean upstream merge requests like
+ https://gitlab.com/sane-project/backends/-/merge_requests/MMM
+ Backends
+ * all backends now respect the 'local_only' parameter when 'true'
+ is passed to 'sane_get_devices()' in that they do not actively
+ go out looking for networked devices (!502)
+ * 'artec_eplus48u': fixes configuration for AstraSlim SE (!545)
+ * 'avision': adds the AV186+ and AV188 as supported (!532)
+ * 'avision': fixes doubled height issue (#402)
+ * 'avision': fixes a debug message and compiler warning (!515)
+ * 'canon_dr': adds support for the DR-C120 and DR-C130 (#175)
+ * 'canon_dr': adds support for uploading of fine calibration
+ uploads
+ * 'canon_dr': enables fine calibration for the P-208
+ * 'canon_dr': improves DR-C225 support (#431)
+ * 'canon_lide70': adds support for document scanning
+ on the Canon LiDE 600(F), thanks to a hardware donation
+ by Georg Sauthoff
+ * 'dll': fixes a memory leak (!537)
+ * 'epson2': adds support for the ET-2600 (#395)
+ * 'epson2': adds autofocus support for devices
+ that support it (!531)
+ * 'epson2': fixes brightness support for DS-G20000/12000XL (!529)
+ * 'epson2': fixes an unchecked return value issue (!526)
+ * 'escl': adds support for brightness, threshold, sharpen
+ and contrast options (!527, !528)
+ * 'escl': adds support for LaserJet FLowMFP M578
+ and MFP M630 (#424)
+ * 'escl': adds support for DeskJet 2710, 2723 (!519)
+ and 3760 (!554)
+ * 'escl': adds support for the PIXMA TS-5351 (!544)
+ and MG5765 (!517)
+ * 'escl': adds support for the Brother HL-L258DW (!517)
+ * 'escl': fixes Avahi device discovery (!536)
+ * 'escl': fixes crashes for devices without a flatbed (!554)
+ * 'escl': fixes segfaults in option handling (!557)
+ * 'escl': fixes sleep mode (!577)
+ * 'escl': fixes builds without libpoppler-glib-dev (#422)
+ * 'escl': fixes a memory issue in its capability handling (#425)
+ * 'fujitsu': fixes brightness/contrast for the iX500
+ * 'fujitsu': fixes memory corruption for duplex scans
+ * 'genesys': disables support for CanoScan 4400F to prevent
+ possible physical damage (#436)
+ * 'gt68xx': fixes scan cancellation logic (#356)
+ * 'pixma': adds untested support for models
+ released in 2020 (!553)
+ * 'pixma': adds support for ADF scans on the i-SENSYS MF260
+ * 'pixma': adds support for PIXMA M340 buttons
+ and ADF status (!513)
+ * 'pixma': adds an option to control when to calibrate (#321)
+ * 'pixma': fixes support for the MX492 (!548)
+ * 'pixma': fixes ADF support for the MX490 Series
+ * 'pixma': fixes max resolution for ADF scans
+ on the PIXMA M320 (#364)
+ * 'pixma': fixes compile errors when libxml2
+ is not available (#345)
+ * 'plustek': fixes CanoScanN650u discovery (#137)
+ * 'test': fixes several memory leaks (!537)
+ Frontends
+ * 'saned': add support for listening on a custom
+ or ephemeral port via a new '-p'/'--port' option (!549)
+ * 'scanimage': fixes crashes for multi-pass
+ and handheld scans (#408)
+ * 'scanimage': fixes a memory leak (!551)
+ * 'scanimage': fixes option handling
+ for non-compliant backends (#362)
+ Documentation
+ * updates our copy of the GPL with the FSF's current postal
+ address. This changes references to the Library GPL (LGPL-2.0)
+ into refs to the Lesser GPL (LGPL-2.1) but does *not* affect
+ the licensing of our backends (#320).
+ * source code now points to the Free Software Foundation's
+ website for copies of the GPL and LGPL (#320)
+ * updates translations for British English and Ukrainian
+ * adds a pointer to our Ubuntu PPA for pre-built binaries
+ * adds SCSI IDs for the EPSON Perfection 1640SU (!509)
+ * fixes a boat-load of spelling mistakes (!516, thanks @marschap)
+ * updates description files for 'scangearmp2'
+ and 'utsushi' external backends
+ Build
+ * removes support for 'automake' maintainer mode (!522)
+ * removes 'sane' subdirectory from the lock directory
+ to fix issues when the lock directory is on 'tmpfs' (#363)
+ * adds support for builds using GitLab "source" tarballs (#248)
+ * fixes static link scenarios (#124)
+ * fixes 'python' invocations to use the detected program (!525)
+ * disables 'genesys' testsuite when that backend
+ is not built (#354)
+ * suppresses warnings about obsolete autoconf macros (#122)
+ * fixes availability of sane-backends.pot file inputs (#344)
+ * fixes 'configure.ac' for use with 'autoconf-2.70' (#409)
+ * removes CVS keywords from the source to ease use
+ by downstreams that still use CVS (!547)
+ Miscellaneous
+ * udev rules now trigger on all events other
+ than 'remove' (!541). This aims to address a kernel API change
+ introduced in 4.14. The new behaviour may slow down udev's
+ processing of kernel events when still using our plain 'udev'
+ or 'udev+acl' rules, even though these have been optimized
+ slightly (#341). If that bothers you, now is a good time
+ to switch to our 'udev+hwdb' rules in combination with
+ the 'hwdb' database if you have not done so already.
+
+-------------------------------------------------------------------
+Wed Oct 14 11:17:03 CEST 2020 - [email protected]
+
+- sane-backends version upgrade to 1.0.31 for SLE15:
+ * sane-backends version upgrade to 1.0.30
+ fixes memory corruption bugs CVE-2020-12861, CVE-2020-12862,
+ CVE-2020-12863, CVE-2020-12864, CVE-2020-12865,
+ CVE-2020-12866, CVE-2020-12867 (bsc#1172524)
+ cf. the entry below dated "Tue Aug 18 15:15:05 UTC 2020"
+ * sane-backends version upgrade to 1.0.31
+ to further improve hardware enablement for scanner devices
+ (jsc#SLE-15561 and jsc#SLE-15560 with jsc#ECO-2418)
+ * The new sane-backends version requires additionally the
+ libpoppler-glib8 RPM (because of the new escl backend)
+ which is provided by the SLE15 Basesystem-Module.
+
+-------------------------------------------------------------------
+Wed Sep 23 11:56:03 CEST 2020 - [email protected]
+
+- Upgraded to sane-backends version 1.0.31
+ Changes since 1.0.30
+ see https://gitlab.com/sane-project/backends/-/blob/master/NEWS
+ Backends
+ * adds the canon_lide70 backend
+ * avision: adds support for the KODAK i1120,
+ fixes thread cancellation issues,
+ disables exposure option for non-filmscanners
+ * canon_dr: improves error reporting
+ * dmc: fixes compiler warnings on the scan area options
+ * epsonds: rewrites the network I/O following changes
+ made to the epson2 backend in 1.0.30 to fix security issues.
+ Network support is still unsupported.
+ * escl: adds ADF support, fixes many minor issues and improves
+ error handling. Now also supports devices behind a proxy
+ (needs explicit configuration).
+ * fujitsu: adds support for the fi-800R and a card scanning
+ slot, fixes a bug when reading hardware sensors on the first
+ invocation. Adds USB IDs for fi-7800 and fi-7900.
+ * genesys: adds support for the Canon 5600F, Canon LiDE 90,
+ Plustek OpticFilm 7200 and 7200 (v2), 7400, 7600i, 8100
+ and 8200i. Fixes several issues with the Canon 8600F.
+ Adds 4800dpi support for the Canon LiDE 210 and fixes 3200dpi
+ flatbed support on the Canon 8400F. Adds an option to fill
+ dark calibration with a constant. Adds transparency support
+ for gl847 chipset based devices. Fixes CIS scanner support
+ for gl842 chipset based devices. Removes lineart and image
+ enhancement emulation support.
+ * gphoto: supports the PLANon DocuPen RC800 (with a recent
+ enough version of gphoto2)
+ * gt68xx: modifies scan cancellation behaviour
+ * hp5400: adds button support, fixes a scan cancellation
+ crash issue
+ * pixma: add supports for the i-SENSYS MF440 Series and untested
+ support for the PIXMMA G7000 Series and GM4000 Series as well
+ as the i-SENSYS MF720 Series.
+ * plustek: fixes a potential buffer overrun
+ * test: adds gamma options
+ Documentation
+ * removes the SANE Standard. This is now maintained
+ as a separate project at
+ https://gitlab.com/sane-project/standard
+ HTML and PDF versions can be found at
+ https://sane-project.gitlab.io/standard/
+ * adds and updates information for multiple supported and
+ unsupported devices
+ * translation updates for British English, French, German,
+ Italian and Ukranian
+ * scanimage: documents the JPEG compression level
++++ 1842 more lines (skipped)
++++ between /dev/null
++++ and
/work/SRC/openSUSE:Leap:15.2:Update/.sane-backends.15910.new.2401/sane-backends.changes
New:
----
adapt_epkowa.desc_for_yast2-scanner.patch
baselibs.conf
create_hpaio.desc_from_models.dat
create_sane-backends-autoconfig.rules
create_scanner_database
models.dat
sane-backends-1.0.32.tar.gz
sane-backends.changes
sane-backends.spec
sane.reg
saned.socket
[email protected]
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ sane-backends.spec ++++++
#
# spec file for package sane-backends
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# Cf. https://rpm.org/user_doc/conditional_builds.html
# by default enable support for PWG eSCL network backend
%bcond_without escl
# by default disable support for PWG eSCL network backend
#bcond_with escl
Name: sane-backends
BuildRequires: gcc-c++
BuildRequires: libjpeg-devel
BuildRequires: libpng-devel
BuildRequires: libtiff-devel
BuildRequires: libv4l-devel
BuildRequires: net-snmp-devel
BuildRequires: pkgconfig
%if %{with escl}
BuildRequires: pkgconfig(avahi-client) >= 0.6.24
BuildRequires: pkgconfig(libcurl)
# since sane-backends 1.0.31 the escl backend requires libpoppler-glib-devel
# cf. https://gitlab.com/sane-project/backends/-/blob/master/INSTALL.linux
BuildRequires: libpoppler-glib-devel
%endif
BuildRequires: pkgconfig(libusb-1.0)
# The pixma backend requires libxml2
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(systemd)
%systemd_requires
Summary: SANE (Scanner Access Now Easy) Scanner Drivers
License: GPL-2.0+ and SUSE-GPL-2.0+-with-sane-exception and
SUSE-Public-Domain
Group: Hardware/Scanner
Version: 1.0.32
Release: 0
Url: http://www.sane-project.org/
# On https://gitlab.com/sane-project/backends/-/releases
# there are two links, the first one is called "Source code (tar.gz)" that
pointed to
#
https://gitlab.com/sane-project/backends/-/archive/1.0.31/backends-1.0.31.tar.gz
# and the second one is called "sane-backends-1.0.31.tar.gz" that pointed to
#
https://gitlab.com/sane-project/backends/uploads/8bf1cae2e1803aefab9e5331550e5d5d/sane-backends-1.0.31.tar.gz
# The first one "backends-1.0.31.tar.gz" did not build, as it does not contain
a prebuilt configure script,
# and autoconf fails as it requires a complete git clone, see
https://gitlab.com/sane-project/backends/issues/248
# We use the second one "sane-backends-1.0.32.tar.gz" that is a dist tarball
with a prebuilt configure script via
# wget
https://gitlab.com/sane-project/backends/uploads/104f09c07d35519cc8e72e604f11643f/sane-backends-1.0.32.tar.gz
Source0: sane-backends-1.0.32.tar.gz
# Source100... is SUSE specific stuff:
# Source102 is the OpenSLP registration file for the saned:
Source102: sane.reg
# Source110 creates our hpaio.desc file directly from the models.dat file of
HPLIP:
Source110: create_hpaio.desc_from_models.dat
# Source111 is the models.dat file of HPLIP:
Source111: models.dat
# Was initially just dumped in as Source1 to "package baselibs.conf"
# (see the matching explanatory entry in the RPM changelog):
Source190: baselibs.conf
# Source200... is scanner autoconfiguration stuff:
# Source200 and Source201 generate the 56-sane-backends-autoconfig.rules file
# for automated scanner driver activation via udev ("scanner
autoconfiguration").
# Source200 is a copy of /usr/lib/YaST2/bin/create_scanner_database
# to avoid yast2-scanner in BuildRequires which would drag in almost the whole
YaST:
Source200: create_scanner_database
# Source201 actually generates the 56-sane-backends-autoconfig.rules file
# by reading scanner.database which was created before by
create_scanner_database
# to extract the needed info from which create_sane-backends-autoconfig.rules
# generates the 56-sane-backends-autoconfig.rules file:
Source201: create_sane-backends-autoconfig.rules
# Sources 202 and 203 are files to enable socket based service activation which
replaced xinetd
Source202: [email protected]
Source203: saned.socket
# Patch100... is SUSE specific stuff:
# Patch102 adapt_epkowa.desc_for_yast2-scanner.patch adapts epkowa.desc for
yast2-scanner
# (see https://bugzilla.opensuse.org/show_bug.cgi?id=788756#c14).
# It adds "requires DFSG non-free Image Scan software from Avasys" to all
comments
# (or adds such a comment if there is not yet a comment) so that yast2-scanner
# (via "requires DFSG non-free" string match in create_scanner_database)
# shows always the info regarding "Image Scan" download from Avasys
# (compare https://bugzilla.novell.com/show_bug.cgi?id=569917
# and https://bugzilla.novell.com/show_bug.cgi?id=746038).
# Furthermore it removes "unsupported" models from epkowa.desc because
# otherwise there would be confusing model entries shown in yast2-scanner:
Patch102: adapt_epkowa.desc_for_yast2-scanner.patch
# Install into this non-root directory (required when norootforbuild is used):
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# Prerequire /sbin/ldconfig which is used in the traditional bash scriptlets
for post/postun:
PreReq: /sbin/ldconfig
# See https://bugzilla.novell.com/show_bug.cgi?id=437293
%ifarch ppc64
Obsoletes: sane-64bit
%endif
# Up to SLE10 there was the package name 'sane' for 'sane-backends'.
# Therefore this RPM provides 'sane' and it also obsoletes it.
# The {version} is needed in both Provides and Obsoletes
# to avoid a RPMLINT warning that the package obsoletes itself:
Provides: sane = %{version}
Obsoletes: sane < %{version}
# Skip testing devel dependencies required by libtool .la files by the
following comment:
# skip-check-libtool-deps
%description
The software consists of SANE scanner drivers,
"scanimage," and the "saned" daemon.
A SANE scanner driver is used via a SANE front-end.
This package contains the command line front-end "scanimage".
There are graphical front-ends in other packages like
XSane (package xsane), Skanlite for KDE4 (package skanlite),
and Kooka for KDE3 (package kdegraphics3-scan).
The "saned" daemon provides the service "sane-port"
to access scanners that are connected to a server
via network from client hosts that run the "net" meta driver.
%package devel
Summary: Development files for sane-backends
License: GPL-2.0+ and SUSE-GPL-2.0+-with-sane-exception and
SUSE-Public-Domain
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
Requires: net-snmp-devel
%description devel
This package contains the development files for sane-backends.
%package autoconfig
Summary: USB Scanner Autoconfiguration
License: GPL-2.0+ and LGPL-2.1+ and SUSE-Public-Domain
Group: Hardware/Scanner
Requires: sane-backends
# When sane-backends is already installed, try to install also
sane-backends-autoconfig if available:
Supplements: sane-backends
%description autoconfig
USB scanner autoconfiguration happens via udev.
The file /etc/udev/rules.d/56-sane-backends-autoconfig.rules contains
entries for those USB scanners where the USB IDs are known, which are
supported by a free driver, where the support status is "complete" or
"good", and which do not require firmware upload.
When a USB scanner is connected and its USB IDs match to an entry in
the 56-sane-backends-autoconfig.rules file, the matching scanner driver
is activated (i.e. the driver line in /etc/sane.d/dll.conf is
activated).
It enables scanner drivers but never disables them. The reason is that
enabled drivers do not hurt so that an automated disable would make it
only overcomplicated because when more than one scanner uses the same
driver, a complicated check would be needed to avoid that the driver is
accidentally disabled when only one scanner was disconnected.
If you do not like automated driver activation, do not install this
package or remove it when it is already installed.
%prep
%setup -q
# Remove hpoj.desc completely to avoid confusion with its successor hpaio.desc
# because since openSUSE 10.3 the package hp-officeJet (for hpoj.desc) is
dropped.
sed -i -e '/descriptions-external\/hpoj.desc / d' doc/Makefile{.am,.in}
rm doc/descriptions-external/hpoj.desc
# For compliance with the other description files in the sane-backends sources
# change the manufacturer name from "Hewlett Packard" to "Hewlett-Packard":
for d in doc/descriptions-external/hp3770.desc
doc/descriptions-external/hp8200.desc
do sed -i -e '/^:mfg/s/Hewlett Packard/Hewlett-Packard/' $d
done
# Patch100... is SUSE specific stuff:
# Patch102 adapt_epkowa.desc_for_yast2-scanner.patch adapts epkowa.desc for
yast2-scanner
# see https://bugzilla.opensuse.org/show_bug.cgi?id=788756#c14
%patch102
# Source100... is SUSE specific stuff:
# Create our hpaio.desc descriptions-external file
# (use it as bash input because sources may be installed without execute
permissions):
bash %{SOURCE110} <%{SOURCE111} >doc/descriptions-external/hpaio.desc
# Copy the create_scanner_database script from the sources directory to the
build directory
# to avoid that the original source becomes modified later in the install
section
# and ends up in the source RPM, see
https://bugzilla.novell.com/show_bug.cgi?id=463464#c11
cp %{SOURCE200} create_scanner_database
chmod u+x create_scanner_database
%build
export CFLAGS="%{optflags} -D_GNU_SOURCE -DGIMP_ENABLE_COMPAT_CRUFT=1
-fno-strict-aliasing"
export LDFLAGS="-L/%_lib $LDFLAGS"
# Enable pthread instead of fork (used in Debian since Feb 2009 and no issues
so far),
# see https://bugzilla.novell.com/show_bug.cgi?id=633780
# Disable locking because /var/lock/sane/ would be a world-writable directory.
./configure --prefix=/usr \
--exec-prefix=/usr \
--sysconfdir=%{_sysconfdir} \
--libdir=%{_libdir} \
--sbindir=%{_sbindir} \
--mandir=%{_mandir} \
--datadir=%{_datadir} \
--docdir=%{_defaultdocdir}/sane-backends \
--enable-pthread \
--with-usb \
%if %{with escl}
--with-avahi \
%endif
--disable-locking
# Enable locking for backends where "99" is the group of the lockfile path
(LOCKPATH_GROUP)
# because "99" is the group of the user who runs the build when norootforbuild
is used
# and set localstatedir to have the lock files in /var/lock/sane (see
backend/Makefile.in).
# Disabled because locking requires a world-writable /var/lock/sane/ directory:
# --enable-locking \
# --with-group=99 \
# --localstatedir=/var
make
%install
make install DESTDIR=%{buildroot}
# The actual driver modules are installed as libsane-<driver>.so.{version}
# and two libsane-<driver>.so.1 and libsane-<driver>.so links point to them.
# Additionally a libsane-<driver>.la libtool archive file is installed
# which could be used to find the correct module file name to dlopen the module.
# Only the dll meta-backend (/usr/lib/libsane.so.1.0.19) links with driver
modules.
# The dll meta-backend looks only for libsane-<driver>.so.1 and uses dlopen(3)
directly.
# The dll meta-backend needs neither libsane-<driver>.so nor
libsane-<driver>.la.
# RPMLINT complains about libsane-<driver>.so with
"devel-file-in-non-devel-package".
# Therefore the libsane-<driver>.so and libsane-<driver>.la files are simply
removed.
rm %{buildroot}%{_libdir}/sane/libsane-*.so
rm %{buildroot}%{_libdir}/sane/libsane-*.la
# Because of https://bugzilla.novell.com/show_bug.cgi?id=592143 for openSUSE
11.3
# even the /usr/lib/libsane.la file for the dll meta-backend is removed
# regardless that it is unknown how whatever third-party scanning frontend
# may like to link with SANE (i.e. with the dll meta-backend).
# The frontends which are provided by openSUSE /usr/bin/scanimage,
# /usr/bin/xsane, and /usr/bin/skanlite do not need it.
# The /usr/lib/libsane.so link for the dll meta-backend is kept because it is
needed
# during build-time by other packages which need sane-backends to build.
rm %{buildroot}%{_libdir}/libsane.la
# Disable all backends in /etc/sane.d/dll.conf to avoid problems when backends
are active by default:
perl -pi -e 's/^([^#].*)$/#$1/' %{buildroot}%{_sysconfdir}/sane.d/dll.conf
# Allow all users to write into /var/lock/sane/ so that the backends work for
normal users
# and set the sticky bit (i.e. others are not allowed to remove lock files).
# Disabled because package-specific world-writable directories are not allowed:
#chmod 1777 {buildroot}/var/lock/sane/
# Install the descriptions and descriptions-external files.
# These files are the sources to make {_defaultdocdir}/sane/sane-backends/*.html
# but these source files must also exist in the installed sane package
# because YaST needs them to create its scanner database:
for d in descriptions descriptions-external
do install -d -m755 %{buildroot}%{_datadir}/sane/$d
install -m644 doc/$d/*.desc %{buildroot}%{_datadir}/sane/$d
done
# Add ':firmware "required"' entries for the respective scanners to the
descriptions files
# so that YaST can show firmware upload related information to the user of such
a scanner.
# This must be done after build because those entries are a SUSE specific
extension.
# To determine scanners which require firmware upload, search the man pages
# for backends which provide support for firmware upload.
# Use a command like
# for m in /usr/share/man/man5/sane-*
# do man -E ascii -P cat -l $m 2>/dev/null | grep -q -i firmware && echo $m
# done
# to find backend man pages which mention "firmware".
# In version 1.0.19 the following man pages mention "firmware":
# sane-agfafocus: mentiones only "firmware revision" (no firmware upload)
# sane-apple: mentiones only "firmware revision" (no firmware upload)
# sane-artec: mentiones only "problems with firmware v1.92" (no firmware
upload)
# sane-artec_eplus48u: "you need a firmware file for your scanner"
(unconditioned firmware upload)
# sane-bh: mentiones only "requires RSC firmware level 1.5" (no firmware
upload)
# sane-epjitsu: "these scanners require a firmware file" (unconditioned
firmware upload)
# sane-gt68xx: "you need a firmware file for your scanner" (unconditioned
firmware upload)
# sane-hp: mentiones only "no firmware support for contrast" (no firmware
upload)
# sane-matsushita: mentiones only "scanner with proper firmware" (no firmware
upload)
# sane-microtek2: mentiones only "firmware of the scanner provides" (no
firmware upload)
# sane-sharp: mentiones only "bug in the firmware" (no firmware upload)
# sane-snapscan: "USB scanners ... scanners that need a firmware upload"
(conditioned firmware upload)
# sane-st400: mentiones only "firmware revision" (no firmware upload)
# sane-teco2: mentiones only "firmware 1.09" (no firmware upload)
# As far as we know all scanners which use
# the backend gt68xx and the related backend artec_eplus48u
# or the backend epjitsu require a firmware upload,
# see "man sane-gt68xx" and http://www.meier-geinitz.de/sane/gt68xx-backend/
# and see "man sane-artec_eplus48u" and "man sane-epjitsu":
for b in gt68xx artec_eplus48u epjitsu
do sed -i -e 's/^:model.*$/&\n:firmware "required"/'
%{buildroot}%{_datadir}/sane/descriptions/$b.desc
done
# As far as we know (almost) all USB scanners (but not the SCSI scanners)
# which use the backend snapscan require a firmware upload,
# see "man sane-snapscan" and http://snapscan.sourceforge.net/:
sed -i -e 's/^:interface "USB".*$/&\n:firmware "required"/'
%{buildroot}%{_datadir}/sane/descriptions/snapscan.desc
# Only the "SnapScan 1236u" needs no firmware upload (see Suse/Novell bug
#73960):
sed -i -e '/:model "SnapScan 1236u"/,/:firmware "required"/s/required//'
%{buildroot}%{_datadir}/sane/descriptions/snapscan.desc
# Scanner autoconfiguration stuff (packaged in sane-backends-autoconfig):
# It must be done before the udev libsane.rules stuff because the scanner
database is needed there.
# This requires the installed descriptions and descriptions-external files
# because create_scanner_database reads the description files to extract the
needed info
# to create the scanner database from which
create_sane-backends-autoconfig.rules
# extracts the needed info to generate the 56-sane-backends-autoconfig.rules
file
# for automated scanner driver activation via udev.
# Note that driver activation alone is not sufficient
# to have a usable "scanner autoconfiguration" for the user.
# What is also needed are appropriate USB device file permissions
# so that the user's scanning software can access the device.
# But this is already in place via the the udev libsane.rules file
# which contains a superset of USB scanner IDs (all known USB scanner IDs)
# compared to the USB scanner IDs in 56-sane-backends-autoconfig.rules,
# see create_sane-backends-autoconfig.rules for which USB scanners
# automated driver activation is done (basically only those scanners
# which are supported by a free driver, which do not require firmware upload,
# and where the support status is "complete" or "good").
# Modify create_scanner_database to find the description files in the BuildRoot
directory
# (the usual delimiter '/' cannot be used because buildroot contains it too):
sed -i -e
's|/usr/share/sane/descriptions|%{buildroot}/usr/share/sane/descriptions|'
create_scanner_database
# Create the scanner database and store it because it is also needed later
# to disable "unsupported" model entries in the udev libsane.rules file.
# The file name "scanner.database" is used hardcoded in
create_sane-backends-autoconfig.rules.
./create_scanner_database >scanner.database
# Run create_sane-backends-autoconfig.rules which reads scanner.database
# (use it as bash input because sources may be installed without execute
permissions):
bash %{SOURCE201} >autoconfig.rules
# Install the scanner autoconfiguration udev rules file:
install -d %{buildroot}%{_sysconfdir}/udev/rules.d
install -m644 autoconfig.rules
%{buildroot}%{_sysconfdir}/udev/rules.d/56-sane-backends-autoconfig.rules
# Since version 1.0.19 there is udev and HAL support.
# Therefore the old/outdated hotplug stuff is dropped (was never used by
openSUSE).
# Neither tools/hotplug/libsane.usermap nor tools/hotplug/libusbscanner is
installed.
# Also the evil-hack init-script "sane-dev" is no longer provided.
# Regarding udev:
# Modify the generated tools/udev/libsane.rules file as follows:
# All GROUP="scanner" are replaced by GROUP="lp".
# There is no group "scanner" in /etc/group for openSUSE.
# For all-in-one devices (i.e. printer + scanner, e.g. "EPSON Stylus" devices)
# the group must be "lp" so that the CUPS usb backend which runs
# as user "lp" (who is member of the group "lp") can send printing data
# to the printer unit (i.e. the printer interface of the USB device).
# It is sufficiently secure and reasonable easy to use by default
# the same group "lp" for printers and scanners because both kind of devices
# usually require physical user access (to get the printed paper or
# to place a paper on the scanner) so that both kind of devices
# should usually require the same kind of security.
sed -i -e 's/GROUP="scanner"/GROUP="lp"/' tools/udev/libsane.rules
# Regarding SUBSYSTEM=="usb" see the Novell/Suse Bugzilla bug
# https://bugzilla.novell.com/show_bug.cgi?id=294161#c11
sed -i -e '/^SUBSYSTEM/s/"usb_device"/"usb"/' tools/udev/libsane.rules
# Disable all ENV{DEVTYPE} lines because we (Suse/Novell) do not need them.
sed -i -e 's/^ENV{DEVTYPE}/# ENV{DEVTYPE}/' tools/udev/libsane.rules
# Disable entries for USB scanners which are "unsupported"
# but keep the entries for models for which the support status
# is "complete", "good", "basic", "minimal", "untested"
# because libsane.rules disables USB autosuspend
# which is needed as safe default for any scanner
# (regardless to what extent it is actually supported).
# The only exception are unsupported models
# because it seems to be wrong to have "known but unsupported" devices
# listed in the libsane.rules file because it seems not to make sense
# to set owner, group, and permissions for devices which are not
# supported by SANE which would even cause conflicts if such a
# device is supported by whatever other software,
# see https://bugzilla.novell.com/show_bug.cgi?id=439193
# Extract a list of USB IDs for "unsupported" scanners and store them in
unsupportedUSBIDs.
# It can happen that there is a status "unsupported" entry for a backend
# for a model which is actually supported by another backend, for example
# the "Epson Perfection 1670" is "unsupported" by the "epkowa" backend
# but works "good" with the "snapscan" backend
# see https://bugzilla.novell.com/show_bug.cgi?id=439193#c6
cat /dev/null >unsupportedUSBIDs
for USBID in $( grep
'||[^|]*|0x[0-9A-Fa-f][0-9A-Fa-f]*:0x[0-9A-Fa-f][0-9A-Fa-f]*|unsupported|'
scanner.database | cut -s -d '|' -f 7 | sort -f -u )
do grep -o "|$USBID|.*|" scanner.database | grep -E -q
'complete|good|basic|minimal|untested' || echo $USBID >>unsupportedUSBIDs
done
# Ignore case when using sed to avoid possible problems
# with upper case letters in the USB IDs:
for m in $( sed -e 's/0x/./ig' -e 's/:/.,.ATTR.idProduct.==/' unsupportedUSBIDs
)
do if grep -q "^ATTR.idVendor.==$m" tools/udev/libsane.rules
then echo "Disabling unsupported model matching ATTR.idVendor.==$m"
sed -i -e "/^ATTR.idVendor.==$m/Is/^ATTR/# ATTR/"
tools/udev/libsane.rules
fi
done
# Newer udev versions complain about NAME="%k" usage with warning messages like
# 'udevd[1234]: NAME="%k" is superfluous and breaks kernel supplied names...'
sed -i -e 's/NAME="%k", //' tools/udev/libsane.rules
# Add a wildcard entry for any "SCSI processor EPSON SCANNER*"
# see http://lists.alioth.debian.org/pipermail/sane-devel/2011-June/028739.html
sed -i -e '/^# Epson Perfection 2450 /i# Any SCSI processor EPSON
SCANNER...\nKERNEL=="sg[0-9]*", ATTRS{type}=="3", ATTRS{vendor}=="EPSON",
ATTRS{model}=="SCANNER*", MODE="0664", GROUP="lp", ENV{libsane_matched}="yes"'
tools/udev/libsane.rules
# Install the udev rules file:
install -m644 tools/udev/libsane.rules
%{buildroot}%{_sysconfdir}/udev/rules.d/55-libsane.rules
# Service files:
# Sources 202 and 203 are files to enable socket based service activation which
replaced xinetd
# Source202 is [email protected] and Source203 is saned.socket
# see https://bugzilla.opensuse.org/show_bug.cgi?id=1074054#c5
# and https://bugzilla.opensuse.org/attachment.cgi?id=760460
install -d -m755 %{buildroot}%{_unitdir}
install -m644 %{SOURCE202} %{buildroot}%{_unitdir}
install -m644 %{SOURCE203} %{buildroot}%{_unitdir}
# OpenSLP registration stuff:
install -d -m755 %{buildroot}%{_sysconfdir}/slp.reg.d
install -m644 %{SOURCE102} %{buildroot}%{_sysconfdir}/slp.reg.d
# Delete documentation files for non-Linux platforms:
rm
%{buildroot}%{_defaultdocdir}/sane-backends/{README.aix,README.beos,README.darwin,README.djpeg,README.freebsd,README.hp-ux,README.netbsd,README.openbsd,README.os2,README.solaris,README.unixware2,README.unixware7,README.windows,README.zeta}
# Mark locale-dependent files with the respective 'lang' tag in the file list,
see
# https://en.opensuse.org/openSUSE:Packaging_Conventions_RPM_Macros#.25find_lang
%find_lang sane-backends
%pre
if [ $1 = 2 ] ; then
# In case of an upgrade the erroneously created as directories saned.socket
and [email protected]
# must be removed, otherwise the upgrade will fail,
# see https://bugzilla.opensuse.org/show_bug.cgi?id=1074054#c5
# and https://bugzilla.opensuse.org/attachment.cgi?id=760460
if [ -d /usr/lib/systemd/system/saned.socket ] ; then
/usr/bin/rmdir /usr/lib/systemd/system/saned.socket
fi
if [ -d /usr/lib/systemd/system/[email protected] ] ; then
/usr/bin/rmdir /usr/lib/systemd/system/[email protected]
fi
fi
%service_add_pre saned.socket
%post
/sbin/ldconfig
%service_add_post saned.socket
%preun
%service_del_preun saned.socket
%postun
/sbin/ldconfig
%service_del_postun saned.socket
%files -f sane-backends.lang
%defattr(-,root,root)
%dir %{_sysconfdir}/sane.d
%config(noreplace) %{_sysconfdir}/sane.d/*.conf
%dir %{_sysconfdir}/slp.reg.d
%config(noreplace) %{_sysconfdir}/slp.reg.d/*
%dir %{_sysconfdir}/udev
%dir %{_sysconfdir}/udev/rules.d
%{_sysconfdir}/udev/rules.d/55-libsane.rules
%{_sbindir}/saned
%{_bindir}/scanimage
%{_bindir}/sane-find-scanner
%{_bindir}/gamma4scanimage
%{_bindir}/umax_pp
%{_datadir}/sane/
%{_libdir}/libsane.so.*
%{_libdir}/sane/
%{_unitdir}/[email protected]
%{_unitdir}/saned.socket
#dir /var/lock/sane
%doc %{_defaultdocdir}/sane-backends/
%doc %{_mandir}/man1/scanimage.1.gz
%doc %{_mandir}/man1/sane-find-scanner.1.gz
%doc %{_mandir}/man1/gamma4scanimage.1.gz
%doc %{_mandir}/man5/sane-*.5.gz
%doc %{_mandir}/man7/sane.7.gz
%doc %{_mandir}/man8/saned.8.gz
%files devel
%defattr(-,root,root)
%{_bindir}/sane-config
%{_includedir}/sane/
%{_libdir}/libsane.so
%{_libdir}/pkgconfig/sane-backends.pc
%doc %{_mandir}/man1/sane-config.1.gz
%files autoconfig
%defattr(-,root,root)
%dir %{_sysconfdir}/udev
%dir %{_sysconfdir}/udev/rules.d
%{_sysconfdir}/udev/rules.d/56-sane-backends-autoconfig.rules
%changelog
++++++ adapt_epkowa.desc_for_yast2-scanner.patch ++++++
++++ 4053 lines (skipped)
++++++ baselibs.conf ++++++
sane-backends
sane-backends-devel
++++++ create_hpaio.desc_from_models.dat ++++++
#! /bin/bash
#
# Johannes Meixner <[email protected]>, 2008
#set -x
export PATH="/sbin:/usr/sbin:/usr/bin:/bin"
export LC_ALL="POSIX"
export LANG="POSIX"
umask 022
MY_NAME=${0##*/}
# Input:
# Create a temporary file:
TMP_DATA=$(mktemp -u /tmp/$MY_NAME.XXXXXX) || { echo "Error: Failed to make a
temporary file /tmp/$MY_NAME.XXXXXX" 1>&2 ; exit 1 ; }
# Get the raw data:
egrep '^\[|^model[1-9]*|^scan-type|^usb-pid' | sed -e
's/^\[\(.*\)\]$/class=\1/' -e 's/ /_/g' -e 's/=/ /' >$TMP_DATA
# Output:
# Output header:
echo ':backend "hpaio"'
echo ':version "3.9.8"'
echo ':url "http://hplipopensource.com"'
echo ':comment "This backend is not included in SANE because it is included in
the HPLIP software."'
echo ':devicetype :scanner'
echo ':mfg "Hewlett-Packard"'
echo ':url
"http://www.hp.com/united-states/consumer/gateway/printing_multifunction.html"'
echo
# Add a generic entry (the "Any" with capital 'A' lets it appear at the top of
YaST's sorted list):
# This USB ID ("0x03f0" "0x0000") is used as fallback by the YaST scanner
autodetection
# via /usr/lib/YaST2/bin/autodetect_scanners which calls "hp-probe -busb -escan"
# because hp-probe does not show the USB ID. With this USB ID the generic entry
matches
# to any autodetected HPLIP USB all-in-one device (the "-escan" excludes plain
printers)
# so that the usually right driver (hpaio) can be preselected by YaST.
# Nevertheless, to be on the safe side, the support status is set to "untested".
echo ':model "Any all-in-one device"'
echo ':usbid "0x03f0" "0x0000"'
echo ':status :untested'
echo ':comment "fallback entry for HP all-in-one devices"'
echo
# Function to unify a model name:
Unify()
{ MODEL=$( echo $MODEL | sed -e 's/hp_//i' -e 's/Aii-in-One/all-in-one/i' )
for w in LaserJet Mopier DeskJet Business Inkjet Officejet Photosmart PSC
Printer Scanner Copier DJ CP CM MFP Apollo series Color all-in-one
do MODEL=$( echo $MODEL | sed -e "s/$w/$w/i" )
done
}
# Function to output one model entry:
Output()
{ if [ -n "$CLASS" -a ! "0" = "$TYPE" ]
then UNIFIEDMODELS=""
for MODEL in $( echo $MODELS )
do Unify
UNIFIEDMODELS=$( echo $UNIFIEDMODELS $MODEL )
done
UNIFIEDMODELS=$( echo $UNIFIEDMODELS | tr ' ' '\n' | sort -u | tr '\n' '
' )
for MODEL in $( echo $UNIFIEDMODELS )
do MODEL=$( echo $MODEL | sed -e "s/_/ /g" )
echo ":model \"$MODEL\""
if echo "$ID" | grep -q '[1-9a-f]'
then if echo "$ID" | grep -q '^[0-9a-f][0-9a-f][0-9a-f][0-9a-f]$'
then echo ":usbid \"0x03f0\" \"0x$ID\""
else if echo "$ID" | grep -q '^[0-9a-f][0-9a-f][0-9a-f]$'
then echo ":usbid \"0x03f0\" \"0x0$ID\""
else if echo "$ID" | grep -q '^[0-9a-f][0-9a-f]$'
then echo ":usbid \"0x03f0\" \"0x00$ID\""
else if echo "$ID" | grep -q '^[1-9a-f]$'
then echo ":usbid \"0x03f0\" \"0x000$ID\""
fi
fi
fi
fi
fi
echo ':status :good'
echo
done
fi
}
# Output model entries:
CLASS=""
exec <$TMP_DATA
while read KEY VALUE
do case "$KEY" in
class) Output
ID=""
TYPE="0"
CLASS="$VALUE"
MODELS="$CLASS" ;;
model*) MODELS=$( echo $MODELS $VALUE ) ;;
scan-type) TYPE="$VALUE" ;;
usb-pid) ID=$( echo "$VALUE" | tr '[:upper:]' '[:lower:]' ) ;;
*) echo "Ignoring key $KEY" 1>&2 ;;
esac
done
# Remove the temporary file
rm $TMP_DATA
exit 0
++++++ create_sane-backends-autoconfig.rules ++++++
#! /bin/bash
#
# Johannes Meixner <[email protected]>, 2004, 2005, 2006
#set -x
export PATH="/sbin:/usr/sbin:/usr/bin:/bin"
export LC_ALL="POSIX"
export LANG="POSIX"
umask 022
MY_NAME=${0##*/}
# Input:
# Create a temporary file:
TMP_DATA=$(mktemp /tmp/$MY_NAME.XXXXXX) || { echo "Error: Failed to make a
temporary file /tmp/$MY_NAME.XXXXXX" 1>&2 ; exit 1 ; }
# Extract only those USB scanners from the scanner database
# which are supported by the packages "sane-backends", "iscan-free", or "hplip"
# (i.e. not by the proprietary 32-bit-only i386-only "iscan" package)
# and which do not require firmware upload (i.e. FIRMWARE field is empty)
# (the INTERFACE field does not matter because it could be empty or stuff like
"Parport USB" or "SCSI USB IEEE-1394")
# and where the USB-ID is known (i.e.
'0x[0-9A-Fa-f][0-9A-Fa-f]*:0x[0-9A-Fa-f][0-9A-Fa-f]*')
# and where the support status is "complete" or "good" (i.e. skip "basic",
"minimal", "untested", "unsupported")
# and keep only the fields of interest (i.e. BACKEND and USBID)
# and keep only unique lines (there are many duplicates among the fields of
interest)
# and sort according to the USB-ID to have different driver lines for the same
model contiguous
# which is needed to choose only one driver which is automatically activated
# because otherwise a scanner will show up multiple times in scanning frontends
# (once for each activated driver which works for this model)
# and finally set the usual input field separator ' ' (there are no blanks in
BACKEND or USB-ID).
egrep '^sane-backends|^iscan-free|^hplip' scanner.database | grep
'||[^|]*|0x[0-9A-Fa-f][0-9A-Fa-f]*:0x[0-9A-Fa-f][0-9A-Fa-f]*|' | cut -s -d '|'
-f 2,7,8 | egrep 'complete$|good$' | cut -s -d '|' -f 1,2 | sort -u | sort -t
'|' -k 2 | tr '|' ' ' >$TMP_DATA
# Output:
# Output header:
echo 'ACTION!="add", GOTO="sane_backends_autoconfig_rules_end"'
echo 'SUBSYSTEM!="usb", GOTO="sane_backends_autoconfig_rules_end"'
echo
# Output the scanner model entries:
USED_BACKENDS=""
PREVIOUS_VENDOR=""
PREVIOUS_MODEL=""
BACKENDS_FOR_SAME_MODEL=""
# Append a dummy entry to trigger the output for the last real model in the
while loop:
echo 'dummy 0x0000:0x0000' >>$TMP_DATA
exec <$TMP_DATA
while read BACKEND USBID
do [ -z "$BACKEND" ] && { echo "Ignoring $USBID because there is no driver
entry." 1>&2 ; continue ; }
VENDOR=$( echo $USBID | cut -s -d ':' -f 1 | sed -e 's/^0x//' )
[ -z "$VENDOR" ] && { echo "Ignoring $USBID because there is no vendor ID."
1>&2 ; continue ; }
MODEL=$( echo $USBID | cut -s -d ':' -f 2 | sed -e 's/^0x//' )
[ -z "$MODEL" ] && { echo "Ignoring $USBID because there is no model ID."
1>&2 ; continue ; }
# If the current model is the same as the previous model,
# add only the current backend to the list of backends for the same model:
if [ "$VENDOR" = "$PREVIOUS_VENDOR" -a "$MODEL" = "$PREVIOUS_MODEL" ]
then BACKENDS_FOR_SAME_MODEL=$( echo "$BACKENDS_FOR_SAME_MODEL $BACKEND" )
continue
fi
# When the model has changed,
# determine the "best" backend for the previous model
# and output only one single entry for it.
# Currently different driver lines for the same model happen only
# for Epson scanners (USB vendor ID 0x04b8):
# Many models are supported by epkowa, epson2, and epson (unmaintained
driver).
# Two models are supported by plustek (and the non-free epkowa version in
"iscan")
# One model is supported by epson2 and epson.
# The preferred driver is epkowa because
# it supports more models than the other drivers,
# it is made by the manufacturer (via Epson Avasys), and
# it is free software in the iscan-free package ("iscan" is suppressed, see
above).
# On the one hand this means that when the iscan-free package is not
installed,
# those scanners would not be autoconfigured even if many of those scanners
are also
# supported by the epson2 driver (which is not activated because epkowa is
preferred).
# On the other hand this avoids that different drivers are activated for the
same model
# which lets the model show up several times in the scanning frontend (once
for each driver).
# For example imagine there are two Epson USB scanners connected:
# One is supported only by epkowa, the other one is supported by epkowa and
epson2.
# If both epkowa and epson2 would be activated, the other one would show up
twice.
# Furthermore epson2 is preferred over the meanwhile unmaintained epson
driver.
BEST_BACKEND=""
for B in plustek epson epson2 epkowa
do echo $BACKENDS_FOR_SAME_MODEL | grep -q "$B" && BEST_BACKEND="$B"
done
# Do not use 'cut -s' because BACKENDS_FOR_SAME_MODEL contains usually only
one entry:
[ -z "$BEST_BACKEND" ] && BEST_BACKEND=$( echo $BACKENDS_FOR_SAME_MODEL |
cut -d ' ' -f 1 )
if [ -n "$BEST_BACKEND" ]
then USED_BACKENDS=$( echo "$USED_BACKENDS $BEST_BACKEND" )
echo "ATTR{idVendor}==\"$PREVIOUS_VENDOR\",
ATTR{idProduct}==\"$PREVIOUS_MODEL\", ENV{sane_backend_$BEST_BACKEND}=\"yes\""
fi
# Remember the current model:
BACKENDS_FOR_SAME_MODEL="$BACKEND"
PREVIOUS_VENDOR="$VENDOR"
PREVIOUS_MODEL="$MODEL"
done
echo
# Output the driver activation lines:
for B in $( echo $USED_BACKENDS | tr ' ' '\n' | sort -u )
do echo "ENV{sane_backend_$B}==\"yes\", RUN+=\"/bin/sed -i -e
's/^[[:space:]]*#[[:space:]]*$B[[:space:]]*\$\$/$B/' /etc/sane.d/dll.conf\""
done
echo
# Output footer:
echo 'LABEL="sane_backends_autoconfig_rules_end"'
echo
# Remove the temporary file
rm $TMP_DATA
exit 0
++++++ create_scanner_database ++++++
#! /bin/bash
#
# Johannes Meixner <[email protected]>, 2004, 2005, 2006
#set -x
export PATH="/sbin:/usr/sbin:/usr/bin:/bin"
export LC_ALL="POSIX"
export LANG="POSIX"
umask 022
MY_NAME=${0##*/}
OUTPUT_FORMAT="$1"
[ -z "$OUTPUT_FORMAT" ] && OUTPUT_FORMAT="ASCII"
[ "$OUTPUT_FORMAT" != "ASCII" -a "$OUTPUT_FORMAT" != "YCP" ] && { echo -en
"\nUsage:\n$MY_NAME {ASCII|YCP}\n" 1>&2 ; exit 1 ; }
# Input:
# Create a temporary file:
TMP_DATA=$(mktemp -u /tmp/$MY_NAME.XXXXXX)
cat /dev/null >$TMP_DATA
# Function to extract entries from a description file with SANE syntax.
# Quoted quotation marks '\"' (happens in comments) are replaced by ' ':
Extract()
{ cat $1 | sed -e 's/\\"/ /g' | egrep -o
'^[[:space:]]*:backend[[:space:]]*"[^"]*"|^[[:space:]]*:mfg[[:space:]]*"[^"]*"|^[[:space:]]*:model[[:space:]]*"[^"]*"|^[[:space:]]*:firmware[[:space:]]*"[^"]*"|^[[:space:]]*:interface[[:space:]]*"[^"]*"|^[[:space:]]*:usbid[[:space:]]*"0x[0-9A-Fa-f]*"[[:space:]]*"0x[0-9A-Fa-f]*"|^[[:space:]]*:status[[:space:]]*:[a-z]*|^[[:space:]]*:comment[[:space:]]*"[^"]*"'
}
# Process the SANE description files:
# At least the SANE description files must exist:
PACKAGE="sane-backends"
DESCRIPTION_FILES="/usr/share/sane/descriptions/*.desc"
ls $DESCRIPTION_FILES &>/dev/null || { echo "Error: Required SANE description
files $DESCRIPTION_FILES not found." 1>&2 ; exit 3 ; }
# Write the package which is processed:
echo ":package \"$PACKAGE\"" >>$TMP_DATA
# Extract entries from SANE description files:
for DESCRIPTION_FILE in $DESCRIPTION_FILES
do Extract $DESCRIPTION_FILE
done >>$TMP_DATA
# Process the optional HPLIP external description file:
# The package hplip is installed by default.
PACKAGE="hplip"
DESCRIPTION_FILE="/usr/share/sane/descriptions-external/hpaio.desc"
if [ -r "$DESCRIPTION_FILE" ]
then echo ":package \"$PACKAGE\"" >>$TMP_DATA
Extract $DESCRIPTION_FILE >>$TMP_DATA
else echo "Info: Cannot read $DESCRIPTION_FILE" 1>&2
fi
# Process the optional EPSON AVASYS (formerly EPSON KOWA) Image Scan external
description file:
# The proprietary binary-only i386-only package iscan cannot be installed by
default.
# The package iscan-free is not installed by default.
PACKAGE="iscan"
DESCRIPTION_FILE="/usr/share/sane/descriptions-external/epkowa.desc"
if [ -r "$DESCRIPTION_FILE" ]
then echo ":package \"$PACKAGE\"" >>$TMP_DATA
Extract $DESCRIPTION_FILE >>$TMP_DATA
else echo "Info: Cannot read $DESCRIPTION_FILE" 1>&2
fi
# Process the collected data:
# Replace HTML tags:
sed -i -e 's/<[Bb][Rr]>/, /g' \
-e 's/<[Pp]>/, /g' \
-e 's/<[^>]*>/ /g' $TMP_DATA
# Condense multiple spaces and convert tabs to blanks:
sed -i -e 's/[[:space:]][[:space:]]*/ /g' $TMP_DATA
# Remove leading and trailing spaces:
sed -i -e 's/^[[:space:]]*//' \
-e 's/[[:space:]]*$//' \
-e 's/"[[:space:]]*/"/g' \
-e 's/[[:space:]]*"$/"/' $TMP_DATA
# Convert the usbid values from '"vendor-id""product-id"' to
'"vendor-id:product-id"'
# (note that '" "' was changed to '""' in the step before):
sed -i -e '/^:usbid/s/""/:/' $TMP_DATA
# Convert the status value to the usual string format:
sed -i -e 's/^:status :\(.*\)/:status "\1"/' $TMP_DATA
# Equalize different spelling of same manufacturers:
sed -i -e 's/"AGFA"/"Agfa"/g' \
-e 's/"UMAX"/"Umax"/g' $TMP_DATA
# Change meaningless references to a meaningful reference:
sed -i -e 's/see link/see http:\/\/www.sane-project.org/g' \
-e 's/See link/See http:\/\/www.sane-project.org/g' $TMP_DATA
# Output:
# Output header:
if [ "$OUTPUT_FORMAT" = "YCP" ]
then echo "["
else echo
"PACKAGE|BACKEND|MANUFACTURER|MODEL|FIRMWARE|INTERFACE|USBID|STATUS|COMMENT"
fi
# Function to output one scanner entry:
Output()
{ if [ -n "$PACKAGE" -a -n "$BACKEND" -a -n "$MANUFACTURER" -a -n "$MODEL" -a
-n "$STATUS" ]
then [ -z "$FIRMWARE" ] && FIRMWARE='""'
[ -z "$INTERFACE" ] && INTERFACE='""'
[ -z "$USBID" ] && USBID='""'
[ -z "$COMMENT" ] && COMMENT='""'
if [ "$PACKAGE" = '"iscan"' -o "$PACKAGE" = '"iscan-free"' ]
then if echo "$COMMENT" | egrep -q 'requires a DFSG non-free
module|requires DFSG non-free'
then PACKAGE='"iscan"'
else PACKAGE='"iscan-free"'
fi
fi
if [ "$OUTPUT_FORMAT" = "YCP" ]
then echo -e " \$[ \"package\":$PACKAGE,\n \"backend\":$BACKEND,\n
\"manufacturer\":$MANUFACTURER,\n \"model\":$MODEL,\n
\"firmware\":$FIRMWARE,\n \"interface\":$INTERFACE,\n
\"usbid\":$USBID,\n \"status\":$STATUS,\n \"comment\":$COMMENT\n ],"
else echo
"$PACKAGE|$BACKEND|$MANUFACTURER|$MODEL|$FIRMWARE|$INTERFACE|$USBID|$STATUS|$COMMENT"
| tr -d '"'
fi
fi
}
# Make complete and seperated scanner entries:
# Package, backend, manufacturer and model should appear in this order.
# Interface, status and comment are optional and can appear in any order.
# There is no mandatory key which is always last.
# Therefore the values are collected until package or backend or manufacturer
or model changes.
# When package or backend or manufacturer or model changes the values are
output.
exec <$TMP_DATA
while read KEY VALUE
do expr "$VALUE" : '"[^"]*"$' &>/dev/null || { echo "Ignoring $VALUE because it
has not the right syntax \"...\"." 1>&2 ; continue ; }
case "$KEY" in
:package) Output
PACKAGE="$VALUE"
BACKEND=""
MANUFACTURER=""
MODEL=""
FIRMWARE=""
INTERFACE=""
USBID=""
STATUS=""
COMMENT="" ;;
:backend) Output
BACKEND=$( echo "$VALUE" | tr '[:upper:]' '[:lower:]' )
MANUFACTURER=""
MODEL=""
FIRMWARE=""
INTERFACE=""
USBID=""
STATUS=""
COMMENT="" ;;
:mfg) Output
MANUFACTURER="$VALUE"
MODEL=""
FIRMWARE=""
INTERFACE=""
USBID=""
STATUS=""
COMMENT="" ;;
:model) Output
MODEL="$VALUE"
FIRMWARE=""
INTERFACE=""
USBID=""
STATUS=""
COMMENT="" ;;
:firmware) FIRMWARE="$VALUE" ;;
:interface) INTERFACE="$VALUE" ;;
:usbid) USBID=$( echo "$VALUE" | tr '[:upper:]' '[:lower:]' ) ;;
:status) STATUS="$VALUE" ;;
:comment) COMMENT="$VALUE" ;;
*) echo "Ignoring key $KEY" 1>&2 ;;
esac
done
# Output the last scanner entry and a footer for YCP
Output
if [ "$OUTPUT_FORMAT" = "YCP" ]
then echo -e " \$[]\n]"
fi
# Remove the temporary file
rm $TMP_DATA
exit 0
++++++ models.dat ++++++
++++ 45713 lines (skipped)
++++++ sane.reg ++++++
#############################################################################
#
# OpenSLP registration file for the scanner daemon (SANE)
#
#############################################################################
#comment
;comment
##Register a saned service on this system
service:scanner.sane://$HOSTNAME:6566,en,65535
# for inetd usage:
tcp-port=6566
description=SANE scanner daemon
++++++ saned.socket ++++++
[Unit]
Description=saned incoming socket
[Socket]
ListenStream=6566
Accept=yes
MaxConnections=1
[Install]
WantedBy=sockets.target
++++++ [email protected] ++++++
[Unit]
Description=Scanner Service
Requires=saned.socket
[Service]
ExecStart=/usr/sbin/saned
User=root
Group=root
StandardInput=socket
Environment=SANE_CONFIG_DIR=/etc/sane.d
[Install]
Also=saned.socket