git: ff2941686756 - main - sysutils/scanbd: Make the port better behaved.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 Jun 2023 23:28:06 UTC
The branch main has been updated by fuz:
URL: https://cgit.FreeBSD.org/ports/commit/?id=ff2941686756eeffa63a57949cf6a2150bc5d5fb
commit ff2941686756eeffa63a57949cf6a2150bc5d5fb
Author: Trenton Schulz <trenton@norwegianrockcat.com>
AuthorDate: 2023-06-18 09:40:06 +0000
Commit: Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-06-26 22:58:23 +0000
sysutils/scanbd: Make the port better behaved.
- Address issues in rclint, portlint and the port test tool.
- make sure scanbd.conf is a sample file.
PR: 272066
---
sysutils/scanbd/Makefile | 12 +++++++--
sysutils/scanbd/files/patch-conf_scanbd.conf | 38 ++++++++++++++++++++++++++++
sysutils/scanbd/files/scanbd.in | 24 ++++++++++++++----
sysutils/scanbd/pkg-plist | 12 ++++-----
4 files changed, 73 insertions(+), 13 deletions(-)
diff --git a/sysutils/scanbd/Makefile b/sysutils/scanbd/Makefile
index 9ee2ef19027b..d94376c62c37 100644
--- a/sysutils/scanbd/Makefile
+++ b/sysutils/scanbd/Makefile
@@ -1,5 +1,6 @@
PORTNAME= scanbd
DISTVERSION= 1.5.1
+PORTREVISION= 1
CATEGORIES= sysutils
MAINTAINER= trueos@norwegianrockcat.com
@@ -24,15 +25,22 @@ GL_COMMIT= 4503640d202c06510f21848a684e221f613f324b
GNU_CONFIGURE= yes
-CONFIGURE_ARGS+= --with-user --with-group
+CONFIGURE_ARGS+= --with-user=saned --with-group=saned
-SHEBANG_GLOB= *.script
+SHEBANG_GLOB= *.script
USE_RC_SUBR= scanbd
SUB_FILES= scanbd
+post-patch:
+ @${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|g' ${WRKSRC}/conf/scanbd.conf
+
post-install:
+ ${MV} ${STAGEDIR}${ETCDIR}/scanbd.conf ${STAGEDIR}${ETCDIR}/scanbd.conf.sample
+ ${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
+ ${MV} ${STAGEDIR}${ETCDIR}/scripts ${STAGEDIR}${EXAMPLESDIR}
+ ${MKDIR} ${STAGEDIR}${PREFIX}/etc/rc.d
${INSTALL_SCRIPT} ${WRKDIR}/scanbd ${STAGEDIR}${PREFIX}/etc/rc.d/scanbd
.include <bsd.port.mk>
diff --git a/sysutils/scanbd/files/patch-conf_scanbd.conf b/sysutils/scanbd/files/patch-conf_scanbd.conf
new file mode 100644
index 000000000000..7c786843d6ee
--- /dev/null
+++ b/sysutils/scanbd/files/patch-conf_scanbd.conf
@@ -0,0 +1,38 @@
+--- conf/scanbd.conf.orig 2023-06-18 13:49:49 UTC
++++ conf/scanbd.conf
+@@ -30,7 +30,7 @@ global {
+
+ # debug logging
+ # 1=error, 2=warn, 3=info, 4-7=debug
+- debug-level = 7
++ debug-level = 2
+
+ # drop priviliges to this user
+ #=============================
+@@ -52,12 +52,12 @@ global {
+ # *BSD (no group lp here, use daemon instead)
+ # group = daemon # root
+ #
+- group = lp
++ group = saned
+
+ # the saned executable for manager-mode
+- saned = "/usr/sbin/saned"
++ saned = "/usr/local/sbin/saned"
+ saned_opt = {} # string-list
+- saned_env = { "SANE_CONFIG_DIR=/etc/scanbd" } # list of environment vars for saned
++ saned_env = { "SANE_CONFIG_DIR=/usr/local/etc/scanbd" } # list of environment vars for saned
+
+ # Scriptdir specifies where scanbd normally looks for scripts.
+ # The scriptdir option can be defined as:
+@@ -68,8 +68,8 @@ global {
+ # sets scriptdir to <path>/etc/scanbd/scripts.
+ # scriptdir = /some/path
+ # sets scriptdir to the specified absolute path
+- # Default scriptdir is <path>/etc/scanbd, this is normally appropriate
+- scriptdir = /etc/scanbd/scripts
++ # Default scriptdir is <path>/etc/scanbd, this is normally
++ scriptdir = /usr/local/share/examples/scanbd/scripts
+
+ # Scripts to execute upon device insertion/removal.
+ # It can be necessary to load firmware into the device when it is first
diff --git a/sysutils/scanbd/files/scanbd.in b/sysutils/scanbd/files/scanbd.in
index e2924b9c6f9b..cbee8687e477 100755
--- a/sysutils/scanbd/files/scanbd.in
+++ b/sysutils/scanbd/files/scanbd.in
@@ -1,16 +1,30 @@
#!/bin/sh
# PROVIDE: scanbd
-# REQUIRE: DAEMON FILESYSTEMS dbus
-# KEYWORD:
+# REQUIRE: DAEMON FILESYSTEMS LOGIN dbus
+# KEYWORD: shutdown
+#
+# Add these lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable the service
+# scanbd_enable (bool): Set to NO by default.
+# Set to YES to enable scanbd.
+# scanbd_config (path): set to %%PREFIX%%/etc/scanbd/scanbd.conf
+# by default
+
. /etc/rc.subr
name=scanbd
-# scanbd_user=saned # Fix this
+desc="Scanbd: Scan button Daemon"
rcvar=scanbd_enable
-command_args=""
-command="%%PREFIX%%/sbin/${name}"
load_rc_config $name
+
+: ${scanbd_enable:=NO}
+: ${scanbd_config="%%PREFIX%%/etc/scanbd/scanbd.conf"}
+
+command_args="-c $scanbd_config"
+command="%%PREFIX%%/sbin/${name}"
+
+
run_rc_command "$1"
diff --git a/sysutils/scanbd/pkg-plist b/sysutils/scanbd/pkg-plist
index 11a68ee236ce..8bd096a4e0a7 100644
--- a/sysutils/scanbd/pkg-plist
+++ b/sysutils/scanbd/pkg-plist
@@ -1,9 +1,9 @@
-%%ETCDIR%%/scripts/action.script
-%%ETCDIR%%/scripts/example.script
-%%ETCDIR%%/scripts/insert.script
-%%ETCDIR%%/scripts/scanadf.script
-%%ETCDIR%%/scripts/test.script
-%%ETCDIR%%/scanbd.conf
+%%EXAMPLESDIR%%/scripts/action.script
+%%EXAMPLESDIR%%/scripts/example.script
+%%EXAMPLESDIR%%/scripts/insert.script
+%%EXAMPLESDIR%%/scripts/scanadf.script
+%%EXAMPLESDIR%%/scripts/test.script
+@sample %%ETCDIR%%/scanbd.conf.sample
%%ETCDIR%%/scanner.d/avision.conf
%%ETCDIR%%/scanner.d/canon.conf
%%ETCDIR%%/scanner.d/fujitsu.conf