diff --git a/SOURCES/66-saned.rules b/SOURCES/66-saned.rules new file mode 100644 index 0000000..b3ab794 --- /dev/null +++ b/SOURCES/66-saned.rules @@ -0,0 +1,2 @@ +# udev rule for saned (SANE scanning daemon) to be able to write on usb port +ENV{libsane_matched}=="yes", RUN+="/usr/bin/setfacl -m g:saned:rw $env{DEVNAME}" diff --git a/SOURCES/sane-backends-saned-manpage.patch b/SOURCES/sane-backends-saned-manpage.patch new file mode 100644 index 0000000..63123fe --- /dev/null +++ b/SOURCES/sane-backends-saned-manpage.patch @@ -0,0 +1,24 @@ +diff -up sane-backends-1.0.24/doc/saned.man.saned-manpage sane-backends-1.0.24/doc/saned.man +--- sane-backends-1.0.24/doc/saned.man.saned-manpage 2017-11-22 15:53:48.268950048 +0100 ++++ sane-backends-1.0.24/doc/saned.man 2017-11-22 16:19:08.411273673 +0100 +@@ -274,6 +274,20 @@ systemd allows debugging output from bac + .B SANE_DEBUG_ + to be captured. With the service unit as described above, the debugging output is + forwarded to the system log. ++ ++After creating unit files run as root: ++.PP ++.RS ++systemctl start saned.socket ++.RE ++.PP ++to start saned. If you want to have saned.socket running after startup, run as ++root: ++.PP ++.RS ++systemctl enable saned.socket ++.RE ++.PP + .SH FILES + .TP + .I /etc/hosts.equiv diff --git a/SOURCES/saned.socket b/SOURCES/saned.socket new file mode 100644 index 0000000..1aa19e7 --- /dev/null +++ b/SOURCES/saned.socket @@ -0,0 +1,10 @@ +[Unit] +Description=saned incoming socket + +[Socket] +ListenStream=6566 +Accept=yes +MaxConnections=1 + +[Install] +WantedBy=sockets.target diff --git a/SOURCES/saned@.service.in b/SOURCES/saned@.service.in new file mode 100644 index 0000000..d2c0a26 --- /dev/null +++ b/SOURCES/saned@.service.in @@ -0,0 +1,18 @@ +[Unit] +Description=Scanner Service +Requires=saned.socket + +[Service] +ExecStart=/usr/sbin/saned +User=saned +Group=saned +StandardInput=null +StandardOutput=syslog +StandardError=syslog +Environment=SANE_CONFIG_DIR=@CONFIGDIR@ +# If you need to debug your configuration uncomment the next line and +# change it as appropriate to set the desired debug options +# Environment=SANE_DEBUG_DLL=255 SANE_DEBUG_NET=255 + +[Install] +Also=saned.socket diff --git a/SPECS/sane-backends.spec b/SPECS/sane-backends.spec index 3d111a4..a54746e 100644 --- a/SPECS/sane-backends.spec +++ b/SPECS/sane-backends.spec @@ -1,4 +1,4 @@ -#if !0%{?fedora}%{?rhel} || 0%{?fedora} >= 17 || 0%{?rhel} >= 7 +#if !0%%{?fedora}%%{?rhel} || 0%%{?fedora} >= 17 || 0%%{?rhel} >= 7 #global needs_multilib_quirk 0 #else # let -devel require drivers to make them available as multilib @@ -37,7 +37,7 @@ Summary: Scanner access software Name: sane-backends Version: 1.0.24 -Release: 11%{?dist} +Release: 12%{?dist} # lib/ is LGPLv2+, backends are GPLv2+ with exceptions # Tools are GPLv2+, docs are public domain # see LICENSE for details @@ -46,6 +46,9 @@ Group: System Environment/Libraries # Alioth Download URLs are amazing. Source0: https://alioth.debian.org/frs/download.php/latestfile/176/sane-backends-%{version}.tar.gz Source1: sane.png +Source2: saned.socket +Source3: saned@.service.in +Source4: 66-saned.rules # Fedora-specific, not generally applicable: Patch0: sane-backends-1.0.24-udev.patch @@ -79,6 +82,8 @@ Patch7: sane-backends-1.0.24-scsi-permissions.patch # Upstream commit 1207ce5a40664c04b934bd0a6babbc1575361356 # Upstream commit 014b45d920f1fb630e1a31bb01f1da02ea2a6a87 Patch8: sane-backends-1.0.24-usb3-xhci.patch +# RFE: please include the systemd's config files (bug #1512252) +Patch9: sane-backends-saned-manpage.patch URL: http://www.sane-project.org @@ -94,8 +99,13 @@ BuildRequires: libtiff-devel BuildRequires: libv4l-devel BuildRequires: gettext BuildRequires: gphoto2-devel +BuildRequires: systemd-devel +BuildRequires: systemd Requires: systemd >= 196 Requires: sane-backends-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: acl +Requires(pre): shadow-utils +%{?systemd_requires} # Don't drag around obsoletes forever %if 0%{?fedora}%{?rhel} && (0%{?fedora} < 25 || 0%{?rhel} < 8) Obsoletes: sane-backends < 1.0.23-10 @@ -196,6 +206,7 @@ This package contains backend drivers to access digital cameras through SANE. %patch6 -p1 -b .static-code-check %patch7 -p1 -b .scsi-permissions %patch8 -p1 -b .usb3-xhci +%patch9 -p1 -b .saned-manpage %build CFLAGS="%optflags -fno-strict-aliasing" @@ -237,6 +248,7 @@ mkdir -p %{buildroot}%{udevrulesdir} mkdir -p %{buildroot}%{udevhwdbdir} install -m 0644 tools/udev/sane-backends.rules %{buildroot}%{udevrulesdir}/65-sane-backends.rules install -m 0644 tools/udev/sane-backends.hwdb %{buildroot}%{udevhwdbdir}/20-sane-backends.hwdb +install -m 0644 %{SOURCE4} %{buildroot}%{udevrulesdir}/66-saned.rules mkdir -p %{buildroot}%{_libdir}/pkgconfig install -m 0644 tools/sane-backends.pc %{buildroot}%{_libdir}/pkgconfig/ @@ -261,13 +273,30 @@ for f in *; do done popd +install -m 755 -d %{buildroot}%{_unitdir} +install -m 644 %{SOURCE2} %{buildroot}%{_unitdir} +sed 's|@CONFIGDIR@|%{_sysconfdir}/sane.d|g' < %{SOURCE3} > saned@.service +install -m 644 saned@.service %{buildroot}%{_unitdir} + %find_lang %name +%pre +getent group saned >/dev/null || groupadd -r saned +getent passwd saned >/dev/null || \ + useradd -r -g saned -d %{_datadir}/sane -s /sbin/nologin \ + -c "SANE scanner daemon user" saned +exit 0 + %post udevadm hwdb --update >/dev/null 2>&1 || : +%systemd_post saned.socket + +%preun +%systemd_preun saned.socket %postun udevadm hwdb --update >/dev/null 2>&1 || : +%systemd_postun saned.socket %post libs -p /sbin/ldconfig %postun libs -p /sbin/ldconfig @@ -279,7 +308,10 @@ udevadm hwdb --update >/dev/null 2>&1 || : %dir /etc/sane.d/dll.d %config(noreplace) /etc/sane.d/*.conf %{udevrulesdir}/65-sane-backends.rules +%{udevrulesdir}/66-saned.rules %{udevhwdbdir}/20-sane-backends.hwdb +%{_unitdir}/saned.socket +%{_unitdir}/saned@.service %{_datadir}/pixmaps/sane.png %{_bindir}/sane-find-scanner @@ -290,6 +322,7 @@ udevadm hwdb --update >/dev/null 2>&1 || : %{_mandir}/*/* %dir %{_libdir}/sane +%dir %{_datadir}/sane %files doc %defattr(-, root, root) @@ -317,6 +350,12 @@ udevadm hwdb --update >/dev/null 2>&1 || : %{_libdir}/sane/*gphoto2.so* %changelog +* Fri May 04 2018 Zdenek Dohnal - 1.0.24-12 +- 1554406 - saned doesn't have permissions to write on usb port + +* Wed Nov 22 2017 Zdenek Dohnal - 1.0.24-12 +- 1512252 - RFE: please include the systemd's config files + * Tue Oct 10 2017 Zdenek Dohnal - 1.0.24-11 - 1500219 - rebuild against new libgphoto2