diff --git a/brother-scand-git/Makefile.patch b/brother-scand-git/Makefile.patch new file mode 100644 index 0000000..b7c4626 --- /dev/null +++ b/brother-scand-git/Makefile.patch @@ -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 diff --git a/brother-scand-git/PKGBUILD b/brother-scand-git/PKGBUILD new file mode 100644 index 0000000..c0c1166 --- /dev/null +++ b/brother-scand-git/PKGBUILD @@ -0,0 +1,50 @@ +# Maintainer: Michael Kuc +_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 +} diff --git a/brother-scand-git/brother-scand.install b/brother-scand-git/brother-scand.install new file mode 100644 index 0000000..280d325 --- /dev/null +++ b/brother-scand-git/brother-scand.install @@ -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" +}