Received: by mail.netbsd.org (Postfix, from userid 605) id 1732084E94; Wed, 23 May 2018 18:44:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 971A484D9E for ; Wed, 23 May 2018 18:44:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id JLZl2g8yWqrR for ; Wed, 23 May 2018 18:44:53 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id 1A7A184CFB for ; Wed, 23 May 2018 18:44:53 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 15A0EFBEC; Wed, 23 May 2018 18:44:53 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_152710109324470" MIME-Version: 1.0 Date: Wed, 23 May 2018 18:44:53 +0000 From: "Leonardo Taccari" Subject: CVS commit: pkgsrc/chat/bitlbee To: pkgsrc-changes@NetBSD.org Reply-To: leot@netbsd.org X-Mailer: log_accum Message-Id: <20180523184453.15A0EFBEC@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: pkgsrc-changes.NetBSD.org Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_152710109324470 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: leot Date: Wed May 23 18:44:53 UTC 2018 Modified Files: pkgsrc/chat/bitlbee: Makefile pkgsrc/chat/bitlbee/files: bitlbee.sh Log Message: bitlbee: Always create the ${pidfile} directory and improve rc.d script - At least on NetBSD every files on /var/run are removed at every boot by mountcritlocal rc.d script. Add a bitlbee_precmd() function to always check that a directory for the ${pidfile} exists and create it if needed. - Check if /etc/rc.subr exists before source-ing it. - Introduce BITLBEE_USER and BITLBEE_GROUP variables and reuse them to avoid hardcoding `bitlbee' and `nobody' (NFCI) Discussed with and suggestions from , thanks! To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 pkgsrc/chat/bitlbee/Makefile cvs rdiff -u -r1.3 -r1.4 pkgsrc/chat/bitlbee/files/bitlbee.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_152710109324470 Content-Disposition: inline Content-Length: 2276 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii Modified files: Index: pkgsrc/chat/bitlbee/Makefile diff -u pkgsrc/chat/bitlbee/Makefile:1.75 pkgsrc/chat/bitlbee/Makefile:1.76 --- pkgsrc/chat/bitlbee/Makefile:1.75 Fri May 18 17:54:05 2018 +++ pkgsrc/chat/bitlbee/Makefile Wed May 23 18:44:52 2018 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.75 2018/05/18 17:54:05 leot Exp $ +# $NetBSD: Makefile,v 1.76 2018/05/23 18:44:52 leot Exp $ DISTNAME= bitlbee-3.5.1 PKGREVISION= 1 @@ -33,18 +33,22 @@ CONF_FILES= ${DATADIR}/motd.txt ${PKG_S CONF_FILES+= ${EGDIR}/bitlbee.conf ${PKG_SYSCONFDIR}/bitlbee.conf OWN_DIRS+= ${VARBASE}/run/bitlbee -BUILD_DEFS+= VARBASE +BUILD_DEFS+= VARBASE BITLBEE_USER BITLBEE_GROUP +FILES_SUBST+= BITLBEE_USER=${BITLBEE_USER} BITLBEE_GROUP=${BITLBEE_GROUP} EGDIR= ${PREFIX}/share/examples/bitlbee DATADIR= ${PREFIX}/share/bitlbee DOCDIR= ${PREFIX}/share/doc/bitlbee STATEDIR= ${VARBASE}/db/bitlbee -OWN_DIRS_PERMS= ${STATEDIR} bitlbee nobody 700 -OWN_DIRS_PERMS+= ${VARBASE}/run/bitlbee bitlbee nobody 700 +BITLBEE_USER?= bitlbee +BITLBEE_GROUP?= nobody -PKG_GROUPS= nobody -PKG_USERS= bitlbee:nobody +OWN_DIRS_PERMS= ${STATEDIR} ${BITLBEE_USER} ${BITLBEE_GROUP} 700 +OWN_DIRS_PERMS+= ${VARBASE}/run/bitlbee ${BITLBEE_USER} ${BITLBEE_GROUP} 700 + +PKG_GROUPS= ${BITLBEE_GROUP} +PKG_USERS= ${BITLBEE_USER}:${BITLBEE_GROUP} PKG_HOME.bitlbee= ${VARBASE}/db/bitlbee INSTALLATION_DIRS= ${PKGMANDIR}/man5 ${PKGMANDIR}/man8 sbin Index: pkgsrc/chat/bitlbee/files/bitlbee.sh diff -u pkgsrc/chat/bitlbee/files/bitlbee.sh:1.3 pkgsrc/chat/bitlbee/files/bitlbee.sh:1.4 --- pkgsrc/chat/bitlbee/files/bitlbee.sh:1.3 Fri Oct 7 22:37:03 2011 +++ pkgsrc/chat/bitlbee/files/bitlbee.sh Wed May 23 18:44:52 2018 @@ -3,13 +3,25 @@ # PROVIDE: bitlbee # REQUIRE: DAEMON -. /etc/rc.subr +if [ -f /etc/rc.subr ]; then + . /etc/rc.subr +fi name="bitlbee" rcvar=$name command="@PREFIX@/sbin/bitlbee" pidfile="@VARBASE@/run/${name}/pid" command_args="-D" # run as a daemon +start_precmd="bitlbee_precmd" + +bitlbee_precmd() +{ + if [ ! -d "@VARBASE@/run/${name}" ]; then + @MKDIR@ "@VARBASE@/run/${name}" + @CHMOD@ 0700 "@VARBASE@/run/${name}" + @CHOWN@ @BITLBEE_USER@:@BITLBEE_GROUP@ "@VARBASE@/run/${name}" + fi +} if [ -f /etc/rc.subr ]; then load_rc_config $name --_----------=_152710109324470--