pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/net/beanstalkd



Module Name:    pkgsrc
Committed By:   khorben
Date:           Mon Aug 30 22:29:18 UTC 2021

Modified Files:
        pkgsrc/net/beanstalkd: Makefile
        pkgsrc/net/beanstalkd/files: beanstalkd.sh

Log Message:
beanstalkd: let the RC script work unprivileged

This takes advantage of the introduction of the SYSCONFBASE variable.
Tested on NetBSD/amd64.

While there, improve the general behaviour, and avoid `pkill -u` in particular
when stopping the service.

Bumps PKGREVISION.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 pkgsrc/net/beanstalkd/Makefile
cvs rdiff -u -r1.1 -r1.2 pkgsrc/net/beanstalkd/files/beanstalkd.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/net/beanstalkd/Makefile
diff -u pkgsrc/net/beanstalkd/Makefile:1.2 pkgsrc/net/beanstalkd/Makefile:1.3
--- pkgsrc/net/beanstalkd/Makefile:1.2  Tue Apr  6 23:46:53 2021
+++ pkgsrc/net/beanstalkd/Makefile      Mon Aug 30 22:29:18 2021
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.2 2021/04/06 23:46:53 khorben Exp $
+# $NetBSD: Makefile,v 1.3 2021/08/30 22:29:18 khorben Exp $
 
 DISTNAME=      beanstalkd-1.12
+PKGREVISION=   1
 CATEGORIES=    net
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=kr/}
 GITHUB_TAG=    v${PKGVERSION_NOREV}
@@ -14,8 +15,9 @@ USE_TOOLS+=   gmake
 
 B_MANDIR=              ${PKGMANDIR}/man1
 B_DOCDIR=              share/doc/${PKGBASE}
+INSTALLATION_DIRS+=    ${B_MANDIR} ${B_DOCDIR}
+
 RCD_SCRIPTS+=          beanstalkd
-INSTALLATION_DIRS+=    ${B_MANDIR} ${B_DOCDIR} share/examples/rc.d
 
 PKG_GROUPS_VARS+=      BEANSTALKD_GROUP
 PKG_USERS_VARS=                BEANSTALKD_USER
@@ -25,7 +27,6 @@ FILES_SUBST+=         BEANSTALK_USER=${BEANSTAL
 BEANSTALKD_GROUP?=     beanstalkd
 BEANSTALKD_HOME?=      ${VARBASE}/chroot/beanstalkd
 PKG_HOME.beanstalkd?=  ${BEANSTALKD_HOME}
-PLIST_SUBST+=          BEANSTALK_HOME=${BEANSTALKD_HOME}
 PKG_GROUPS=            ${BEANSTALKD_GROUP}
 PKG_GECOS.beanstalkd=  beanstalk daemon
 PKG_USERS=             ${BEANSTALKD_USER}:${BEANSTALKD_GROUP}

Index: pkgsrc/net/beanstalkd/files/beanstalkd.sh
diff -u pkgsrc/net/beanstalkd/files/beanstalkd.sh:1.1 pkgsrc/net/beanstalkd/files/beanstalkd.sh:1.2
--- pkgsrc/net/beanstalkd/files/beanstalkd.sh:1.1       Thu Mar 18 22:54:52 2021
+++ pkgsrc/net/beanstalkd/files/beanstalkd.sh   Mon Aug 30 22:29:18 2021
@@ -1,42 +1,45 @@
 #!/bin/sh
 #
-# $NetBSD: beanstalkd.sh,v 1.1 2021/03/18 22:54:52 khorben Exp $
+# $NetBSD: beanstalkd.sh,v 1.2 2021/08/30 22:29:18 khorben Exp $
 #
 # beanstalkd - simple, fast work queue daemon
 #
 # PROVIDE: beanstalkd
 # REQUIRE: DAEMON NETWORKING SERVERS
+# KEYWORD: shutdown
 #
 # You will need to set some variables in @PKG_SYSCONFDIR@/rc.conf to start beanstalkd:
 #
 # beanstalkd=YES
 
-. /etc/rc.subr
+if [ -f @SYSCONFBASE@/rc.subr ]; then
+       . @SYSCONFBASE@/rc.subr
+       load_rc_config_var beanstalkd_user beanstalkd_user
+       load_rc_config_var beanstalkd_host beanstalkd_host
+       load_rc_config_var beanstalkd_port beanstalkd_port
+fi
 
 name="beanstalkd"
 rcvar=${name}
-beanstalkd_user="@BEANSTALK_USER@"
-beanstalkd_host="127.0.0.1"
-beanstalkd_port="11300"
+beanstalkd_user="${beanstalkd_user:-@BEANSTALK_USER@}"
+beanstalkd_host="${beanstalkd_host:-127.0.0.1}"
+beanstalkd_port="${beanstalkd_port:-11300}"
+pidfile="@VARBASE@/run/${name}.pid"
 start_cmd="beanstalkd_start"
-restart_cmd="beanstalkd_stop ; beanstalkd_start"
-stop_cmd="beanstalkd_stop"
 command="@PREFIX@/bin/${name}"
 command_args="-u ${beanstalkd_user} -l ${beanstalkd_host} -p ${beanstalkd_port}"
 
 beanstalkd_start()
 {
-       ${command} ${command_args} &
-}
-
-beanstalkd_stop()
-{
-        pkill -u @BEANSTALK_USER@ 2>/dev/null
+       echo "Starting ${name}."
+       ${command} ${beanstalkd_flags} ${command_args} &
+       echo $! > ${pidfile}
 }
 
-if [ -f /etc/rc.subr ]; then
+if [ -f @SYSCONFBASE@/rc.subr ]; then
        load_rc_config $name
        run_rc_command "$1"
 else
-       eval ${start_cmd}
+       echo -n "${name}"
+       ${start_cmd}
 fi



Home | Main Index | Thread Index | Old Index