pkgsrc-Changes archive

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

CVS commit: pkgsrc/chat/bitlbee



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 <tonio>, 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.

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



Home | Main Index | Thread Index | Old Index