feat: add brother-scand-git

Adds the package for monitoring networked Brother scanners for button
presses.
This commit is contained in:
2025-12-13 11:12:36 +00:00
parent e028147dff
commit 8e42583c92
3 changed files with 103 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
diff --git a/Makefile b/Makefile
index 12e07e5..719f7e8 100644
--- a/Makefile
+++ b/Makefile
@@ -3,9 +3,9 @@ CFLAGS += -std=gnu11 -pedantic -Wall -Wextra \
-Werror -Wno-missing-braces -Wno-missing-field-initializers \
-Wno-unused-variable -Wno-unused-parameter -Wformat=2 -Wswitch-default \
-Wno-unused-label -Wno-unused-function -Wcast-align -Wpointer-arith -Wbad-function-cast \
- -Wstrict-overflow=5 -Wstrict-prototypes -Winline -Wundef -Wnested-externs \
+ -Wstrict-prototypes -Winline -Wundef -Wnested-externs \
-Wcast-qual -Wshadow -Wunreachable-code -Wfloat-equal \
- -Wstrict-aliasing=2 -Wredundant-decls -Wold-style-definition
+ -Wstrict-aliasing=3 -Wredundant-decls -Wold-style-definition
LDFLAGS = -pthread
SOURCES = con_queue.c log.c device_handler.c event_thread.c config.c connection.c \
data_channel.c snmp.c
@@ -15,11 +15,11 @@ OBJECTS = $(patsubst %.c, build/%.o, $(SOURCES))
DEPS := $(OBJECTS:.o=.d)
EXECUTABLES = build/brother-scand build/brother-scan-cli
FIX_INCLUDE = fix_include
-ETCDIR := /etc/brother-scand
-BINDIR := /usr/bin
+ETCDIR := $(DESTDIR)/etc/brother-scand
+BINDIR := $(DESTDIR)/usr/bin
PRINTUSER := brother-scand
-SYSTEMDPATH := /etc/systemd/system/$(PRINTUSER).service
-SYSLOGPATH := /etc/rsyslog.d/$(PRINTUSER).conf
+SYSTEMDPATH := $(DESTDIR)/etc/systemd/system/$(PRINTUSER).service
+SYSLOGPATH := $(DESTDIR)/etc/rsyslog.d/$(PRINTUSER).conf
all: $(SOURCES) $(EXECUTABLES)
@@ -52,15 +52,12 @@ build/%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
install: all
- adduser --system --no-create-home $(PRINTUSER)
cp $(EXECUTABLES) $(BINDIR)/
mkdir -p $(ETCDIR)
[ -e $(ETCDIR)/scanner.conf ] || cp out/brother.config $(ETCDIR)/scanner.conf
for file in out/*.sh; do [ -e $(ETCDIR)/$$file ] || cp $$file $(ETCDIR)/; done
- chown -R $(PRINTUSER) $(ETCDIR)
cp brother-scand.service $(SYSTEMDPATH)
cp syslog.conf $(SYSLOGPATH)
- echo -e "Now edit $(ETCDIR)/scanner.conf. Then run:\n systemctl restart rsyslog\n systemctl enable $(PRINTUSER)"
install_ufw:
cp brscand.ufw_profile /etc/ufw/applications.d/brscand

View File

@@ -0,0 +1,50 @@
# Maintainer: Michael Kuc <michaelkuc6 at gmail dot com>
_pkgname=brother-scand
pkgname=${_pkgname}-git
pkgver=v0.0.1
pkgrel=1
epoch=
pkgdesc="Network driver for Brother scanner devices. Daemon for press-to-scan functionality."
arch=('x86_64')
url="https://github.com/rumpeltux/brother-scand"
license=('unknown')
groups=()
depends=()
makedepends=()
optdepends=()
provides=($_pkgname)
conflicts=($_pkgname)
replaces=()
backup=()
options=()
install='brother-scand.install'
changelog=
source=(
'git+https://github.com/rumpeltux/brother-scand.git'
'Makefile.patch'
'brother-scand.install'
)
noextract=()
md5sums=(
'SKIP'
'SKIP'
'SKIP'
)
prepare() {
cd "$srcdir/$_pkgname"
patch -p1 -i "$srcdir/Makefile.patch"
}
build() {
cd "$srcdir/$_pkgname"
make
}
package() {
cd "$srcdir/$_pkgname"
install -dm0755 "$pkgdir/usr/bin"
install -dm0755 "$pkgdir/etc/systemd/system"
install -dm0755 "$pkgdir/etc/rsyslog.d"
make DESTDIR="$pkgdir" install
}

View File

@@ -0,0 +1,5 @@
post_install() {
useradd --system --no-create-home brother-scand
chown -R brother-scand /etc/brother-scand
echo -e "Now edit /etc/brother-scand/scanner.conf. Then run:\n systemctl restart rsyslog\n systemctl enable brother-scand"
}