diff --git a/sysutils/scanbd/Makefile b/sysutils/scanbd/Makefile index 9ee2ef19027b..d94376c62c37 100644 --- a/sysutils/scanbd/Makefile +++ b/sysutils/scanbd/Makefile @@ -1,38 +1,46 @@ PORTNAME= scanbd DISTVERSION= 1.5.1 +PORTREVISION= 1 CATEGORIES= sysutils MAINTAINER= trueos@norwegianrockcat.com COMMENT= Scanner button daemon WWW= https://sourceforge.net/projects/scanbd/ LICENSE= GPLv2 BUILD_DEPENDS= sane-config:graphics/sane-backends LIB_DEPENDS= libdbus-1.so:devel/dbus \ libudev.so:devel/libudev-devd \ libconfuse.so:devel/libconfuse RUN_DEPENDS= bash:shells/bash \ scanimage:graphics/sane-backends USES= gettext-runtime gmake pkgconfig shebangfix USE_GITLAB= yes GL_ACCOUNT= sane-project/frontend GL_PROJECT= scanbd 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 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 /etc/scanbd/scripts. + # scriptdir = /some/path + # sets scriptdir to the specified absolute path +- # Default scriptdir is /etc/scanbd, this is normally appropriate +- scriptdir = /etc/scanbd/scripts ++ # Default scriptdir is /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,17 +1,17 @@ -%%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 %%ETCDIR%%/scanner.d/hp.conf %%ETCDIR%%/scanner.d/pixma.conf %%ETCDIR%%/scanner.d/plustek.conf %%ETCDIR%%/scanner.d/snapscan.conf sbin/scanbd sbin/scanbm man/man8/scanbm.8.gz man/man8/scanbd.8.gz