user/sane: add no avahi thread patch
This commit is contained in:
parent
e1aec2ea8c
commit
75e24ea11a
8 changed files with 267 additions and 0 deletions
162
user/sane/APKBUILD
Normal file
162
user/sane/APKBUILD
Normal file
|
@ -0,0 +1,162 @@
|
|||
# Contributor: Fabio Riga <rifabio@dpersonam.me>
|
||||
# Contributor: Valery Kartel <valery.kartel@gmail.com>
|
||||
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
|
||||
pkgname=sane
|
||||
_pkgname=sane-backends
|
||||
pkgver=1.1.1
|
||||
pkgrel=3
|
||||
pkgdesc="Scanner Access Now Easy - universal scanner interface"
|
||||
url="http://www.sane-project.org/"
|
||||
arch="!armv7 all"
|
||||
license="GPL-2.0-or-later GPL-2.0-or-later-with-sane-exception Public-Domain"
|
||||
makedepends="diffutils file libtool libusb-dev v4l-utils-dev net-snmp-dev
|
||||
avahi-dev curl-dev libpng-dev libjpeg-turbo-dev tiff-dev libgphoto2-dev
|
||||
poppler-dev linux-headers libieee1284-dev libxml2-dev"
|
||||
install="$pkgname-saned.pre-install $pkgname.pre-install"
|
||||
pkgusers="saned"
|
||||
pkggroups="scanner"
|
||||
_backends="abaton agfafocus apple artec artec_eplus48u as6e avision bh canon
|
||||
canon630u canon_dr canon_pp cardscan coolscan coolscan2 coolscan3 dc25
|
||||
dc210 dc240 dell1600n_net dmc epjitsu epson epson2 epsonds escl fujitsu
|
||||
genesys gphoto2 gt68xx hp hp3500 hp3900 hp4200 hp5400 hp5590 hpsj5s
|
||||
hpljm1005 hs2p ibm kodak kodakaio kvs1025 kvs20xx kvs40xx leo lexmark
|
||||
ma1509 magicolor matsushita microtek microtek2 mustek mustek_pp mustek_usb
|
||||
mustek_usb2 nec net niash p5 pie pieusb pixma plustek plustek_pp ricoh ricoh2
|
||||
rts8891 s9036 sceptre sharp sm3600 sm3840 snapscan sp15c st400 stv680
|
||||
tamarack teco1 teco2 teco3 test u12 umax umax_pp umax1220u v4l
|
||||
xerox_mfp"
|
||||
|
||||
case "$CARCH" in
|
||||
x86)
|
||||
options="$options !check"
|
||||
_backends="$_backends qcam canon_lide70"
|
||||
;;
|
||||
x86_64)
|
||||
_backends="$_backends qcam canon_lide70"
|
||||
;;
|
||||
esac
|
||||
|
||||
_pkgdesc_dell1600n_net="SANE backend for Dell 1600n that supports colour and monochrome scans over ethernet, usb not supported"
|
||||
for _backend in $_backends; do
|
||||
subpackages="$subpackages $pkgname-backend-$_backend:_backend"
|
||||
done
|
||||
subpackages="$pkgname-doc $pkgname-dev $subpackages $pkgname-utils $pkgname-saned
|
||||
$pkgname-udev::noarch $_pkgname::noarch"
|
||||
source="https://gitlab.com/sane-project/backends/uploads/7d30fab4e115029d91027b6a58d64b43/sane-backends-$pkgver.tar.gz
|
||||
$pkgname-fix-tests.patch::https://gitlab.com/sane-project/backends/-/commit/edfc90450ee06149537fadb3095ba4b215c5c4fa.patch
|
||||
saned.initd
|
||||
include.patch
|
||||
pidfile.patch
|
||||
check.patch
|
||||
sane-backends-no-avahi-thread.patch
|
||||
"
|
||||
builddir="$srcdir"/$_pkgname-$pkgver
|
||||
|
||||
# secfixes:
|
||||
# 1.0.30-r0:
|
||||
# - CVE-2020-12861
|
||||
# - CVE-2020-12862
|
||||
# - CVE-2020-12863
|
||||
# - CVE-2020-12864
|
||||
# - CVE-2020-12865
|
||||
# - CVE-2020-12866
|
||||
# - CVE-2020-12867
|
||||
|
||||
build() {
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc \
|
||||
--with-docdir=/usr/share/doc/$pkgname \
|
||||
--with-usb \
|
||||
--enable-avahi \
|
||||
--disable-rpath \
|
||||
--disable-locking
|
||||
make
|
||||
}
|
||||
|
||||
check() {
|
||||
make check
|
||||
}
|
||||
|
||||
package() {
|
||||
make DESTDIR="$pkgdir" install
|
||||
echo -n "" > "$pkgdir"/etc/$pkgname.d/dll.conf
|
||||
install -Dm644 backend/dll.aliases "$pkgdir"/etc/$pkgname.d/dll.aliases
|
||||
}
|
||||
|
||||
doc() {
|
||||
default_doc
|
||||
mkdir -p "$subpkgdir"/usr/share/licenses/$_pkgname
|
||||
mv "$subpkgdir"/usr/share/doc/$_pkgname/LICENSE \
|
||||
"$subpkgdir"/usr/share/licenses/$_pkgname
|
||||
}
|
||||
|
||||
saned() {
|
||||
local name=${subpkgname#$pkgname-}
|
||||
pkgdesc="$pkgdesc (network scanner server)"
|
||||
mkdir -p "$subpkgdir"/etc/$pkgname.d "$subpkgdir"/usr
|
||||
mv "$pkgdir"/etc/$pkgname.d/$name.conf "$subpkgdir"/etc/$pkgname.d
|
||||
mv "$pkgdir"/usr/sbin "$subpkgdir"/usr/
|
||||
install -Dm755 "$srcdir"/$name.initd "$subpkgdir"/etc/init.d/$name
|
||||
}
|
||||
|
||||
utils() {
|
||||
pkgdesc="$pkgdesc (utilities)"
|
||||
mkdir -p "$subpkgdir"/usr
|
||||
mv "$pkgdir"/usr/bin "$subpkgdir"/usr
|
||||
rm -fr "$pkgdir"/usr/share
|
||||
}
|
||||
|
||||
udev() {
|
||||
pkgdesc="$pkgdesc (udev rules)"
|
||||
install_if="$pkgname=$pkgver-r$pkgrel udev"
|
||||
install -Dm644 "$builddir"/tools/udev/lib$pkgname.rules \
|
||||
"$subpkgdir"/usr/lib/udev/rules.d/49-$pkgname.rules
|
||||
sed -i 's|NAME="%k", ||g' "$subpkgdir"/usr/lib/udev/rules.d/49-$pkgname.rules
|
||||
}
|
||||
|
||||
backends() {
|
||||
local _backend;
|
||||
pkgdesc="$pkgdesc (metapackage)"
|
||||
depends="$pkgname-utils $pkgname-saned"
|
||||
for _backend in $_backends; do
|
||||
[ "$_backend" = "test" ] && continue
|
||||
depends="$depends $pkgname-backend-$_backend"
|
||||
done
|
||||
mkdir -p "$subpkgdir"
|
||||
}
|
||||
|
||||
_backend() {
|
||||
local name=${subpkgname#$pkgname-backend-}
|
||||
depends="$pkgname"
|
||||
pkgdesc=$(eval echo \$_pkgdesc_$name)
|
||||
if [ ! "$pkgdesc" ]; then
|
||||
# cut description from man-page
|
||||
pkgdesc=$(tr '\n' ' ' < "$builddir"/doc/$pkgname-$name.man)
|
||||
pkgdesc=${pkgdesc#*\- }
|
||||
pkgdesc=${pkgdesc%% .SH *};
|
||||
fi
|
||||
mkdir -p "$subpkgdir"/usr/lib/$pkgname \
|
||||
"$subpkgdir"/etc/$pkgname.d/dll.d
|
||||
mv "$pkgdir"/usr/lib/$pkgname/lib$pkgname-$name.* \
|
||||
"$subpkgdir"/usr/lib/$pkgname
|
||||
echo "$name" > "$subpkgdir"/etc/$pkgname.d/dll.d/$name
|
||||
if [ -f "$pkgdir"/etc/$pkgname.d/$name.conf ]; then
|
||||
mv "$pkgdir"/etc/$pkgname.d/$name.conf \
|
||||
"$subpkgdir"/etc/$pkgname.d
|
||||
fi
|
||||
if [ -f "$pkgdir"/usr/bin/$name ]; then
|
||||
mkdir -p "$subpkgdir"/usr/bin
|
||||
mv "$pkgdir"/usr/bin/$name "$subpkgdir"/usr/bin
|
||||
fi
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
25bd9f90d550cfe6a6d01c48e83716a53f4b0e3a294287e455ecb5e5b80c8fe1699f45c6c87f694475cceb85745c70597e18a7b1094669d5091c5fb183dfe94d sane-backends-1.1.1.tar.gz
|
||||
f4187409a85dbdb95213948fcc1bb34cf319a3a5ae34093d1e9e7983dfc89336c75132713e6f3113ad7ef2b0ed78bdc0c6e031796fca7004787776f46c742ec6 sane-fix-tests.patch
|
||||
0a06eaa28b345202f2bdf8361e06f843bb7a010b7d8f80132f742672c94249c43f64031cefa161e415e2e2ab3a53b23070fb63854283f9e040f5ff79394ac7d1 saned.initd
|
||||
1779ff8beb1ba5f9238c25d819a7f0045f7e257c19b511315feb85650e445ca86450a9e1d7ff8650499d3dae808589a6c2e358d5f3f39a3f40ce4999179b86d6 include.patch
|
||||
09505943f9441854a6c333f19e2535b4a646a8cc060fe82c6261e7d29c72773ebe98d43a91acc951f4336a3c8b4c84ab7c7b0763426136b4b59d9546bc2fa8c0 pidfile.patch
|
||||
cfa327209efd9a2a2db7cbcf571852959823aaa19b43d5f6415834cd5ae38b6324ecae16779f6f896aa0d7ac890fe23244100b7d6a68e5e9d52cd38ec82bfac8 check.patch
|
||||
6e6b6336203ee6d1ac96ed2d742e181fb65e8d93386b76d70b6359afbcce98343d89ec8b2b611261f79901779a2999f9262c3f85898bd15c74b00348e0cd3cd7 sane-backends-no-avahi-thread.patch
|
||||
"
|
11
user/sane/check.patch
Normal file
11
user/sane/check.patch
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- a/testsuite/sanei/Makefile.in
|
||||
+++ b/testsuite/sanei/Makefile.in
|
||||
@@ -77,7 +77,7 @@
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
-check_PROGRAMS = sanei_usb_test$(EXEEXT) test_wire$(EXEEXT) \
|
||||
+check_PROGRAMS = test_wire$(EXEEXT) \
|
||||
sanei_check_test$(EXEEXT) sanei_config_test$(EXEEXT) \
|
||||
sanei_constrain_test$(EXEEXT)
|
||||
subdir = testsuite/sanei
|
11
user/sane/include.patch
Normal file
11
user/sane/include.patch
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- a/include/sane/sane.h
|
||||
+++ b/include/sane/sane.h
|
||||
@@ -16,6 +16,8 @@
|
||||
#ifndef sane_h
|
||||
#define sane_h
|
||||
|
||||
+#include <sys/types.h>
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
11
user/sane/pidfile.patch
Normal file
11
user/sane/pidfile.patch
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- a/frontend/saned.c
|
||||
+++ b/frontend/saned.c
|
||||
@@ -224,7 +224,7 @@
|
||||
int numchildren;
|
||||
|
||||
#define SANED_CONFIG_FILE "saned.conf"
|
||||
-#define SANED_PID_FILE "/var/run/saned.pid"
|
||||
+#define SANED_PID_FILE "/run/saned/saned.pid"
|
||||
|
||||
#define SANED_SERVICE_NAME "sane-port"
|
||||
#define SANED_SERVICE_PORT 6566
|
48
user/sane/sane-backends-no-avahi-thread.patch
Normal file
48
user/sane/sane-backends-no-avahi-thread.patch
Normal file
|
@ -0,0 +1,48 @@
|
|||
diff --git a/backend/net.c.orig b/backend/net.c
|
||||
index 7c4aae9..0adfbc2 100644
|
||||
--- a/backend/net.c.orig
|
||||
+++ b/backend/net.c
|
||||
@@ -1043,12 +1043,12 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
|
||||
continue;
|
||||
}
|
||||
#if WITH_AVAHI
|
||||
- avahi_threaded_poll_lock (avahi_thread);
|
||||
+ if(avahi_thread) avahi_threaded_poll_lock (avahi_thread);
|
||||
#endif /* WITH_AVAHI */
|
||||
DBG (2, "sane_init: trying to add %s\n", device_name);
|
||||
add_device (device_name, 0);
|
||||
#if WITH_AVAHI
|
||||
- avahi_threaded_poll_unlock (avahi_thread);
|
||||
+ if(avahi_thread) avahi_threaded_poll_unlock (avahi_thread);
|
||||
#endif /* WITH_AVAHI */
|
||||
}
|
||||
|
||||
@@ -1094,12 +1094,12 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
|
||||
continue;
|
||||
#endif /* ENABLE_IPV6 */
|
||||
#if WITH_AVAHI
|
||||
- avahi_threaded_poll_lock (avahi_thread);
|
||||
+ if(avahi_thread) avahi_threaded_poll_lock (avahi_thread);
|
||||
#endif /* WITH_AVAHI */
|
||||
DBG (2, "sane_init: trying to add %s\n", host);
|
||||
add_device (host, 0);
|
||||
#if WITH_AVAHI
|
||||
- avahi_threaded_poll_unlock (avahi_thread);
|
||||
+ if(avahi_thread) avahi_threaded_poll_unlock (avahi_thread);
|
||||
#endif /* WITH_AVAHI */
|
||||
}
|
||||
free (copy);
|
||||
@@ -1517,11 +1517,11 @@ sane_open (SANE_String_Const full_name, SANE_Handle * meta_handle)
|
||||
"sane_open: device %s not found, trying to register it anyway\n",
|
||||
nd_name);
|
||||
#if WITH_AVAHI
|
||||
- avahi_threaded_poll_lock (avahi_thread);
|
||||
+ if(avahi_thread) avahi_threaded_poll_lock (avahi_thread);
|
||||
#endif /* WITH_AVAHI */
|
||||
status = add_device (nd_name, &dev);
|
||||
#if WITH_AVAHI
|
||||
- avahi_threaded_poll_unlock (avahi_thread);
|
||||
+ if(avahi_thread) avahi_threaded_poll_unlock (avahi_thread);
|
||||
#endif /* WITH_AVAHI */
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
5
user/sane/sane-saned.pre-install
Normal file
5
user/sane/sane-saned.pre-install
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
adduser -SDH -h /run/saned -s /sbin/nologin -G scanner -g saned saned 2>/dev/null
|
||||
|
||||
exit 0
|
5
user/sane/sane.pre-install
Normal file
5
user/sane/sane.pre-install
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
addgroup -S scanner 2>/dev/null
|
||||
|
||||
exit 0
|
14
user/sane/saned.initd
Normal file
14
user/sane/saned.initd
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/sbin/openrc-run
|
||||
|
||||
description="SANE network scanner server"
|
||||
|
||||
owner=saned
|
||||
pidfile=/run/saned/saned.pid
|
||||
cfgfile=/etc/sane.d/saned.conf
|
||||
command=/usr/sbin/saned
|
||||
command_args="-a $owner"
|
||||
required_files="$cfgfile"
|
||||
|
||||
start_pre() {
|
||||
checkpath -dm755 -o $owner ${pidfile%/*}
|
||||
}
|
Loading…
Reference in a new issue