diff options
author | leot <leot@pkgsrc.org> | 2018-05-23 18:44:52 +0000 |
---|---|---|
committer | leot <leot@pkgsrc.org> | 2018-05-23 18:44:52 +0000 |
commit | a53f9d053ac2c12ca501f66e2a41d4c250bc3eda (patch) | |
tree | cec911f5b812e2b93a9038501876be84ec8d348c /chat/bitlbee | |
parent | b928c00577924fc5cec5516a188a1c3ee54be4bf (diff) | |
download | pkgsrc-a53f9d053ac2c12ca501f66e2a41d4c250bc3eda.tar.gz |
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!
Diffstat (limited to 'chat/bitlbee')
-rw-r--r-- | chat/bitlbee/Makefile | 16 | ||||
-rwxr-xr-x | chat/bitlbee/files/bitlbee.sh | 14 |
2 files changed, 23 insertions, 7 deletions
diff --git a/chat/bitlbee/Makefile b/chat/bitlbee/Makefile index 7b0fb179d3a..49ff2224122 100644 --- a/chat/bitlbee/Makefile +++ b/chat/bitlbee/Makefile @@ -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_SYSCONFDIR}/motd.txt 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 diff --git a/chat/bitlbee/files/bitlbee.sh b/chat/bitlbee/files/bitlbee.sh index 5c72cac63bb..e7908d1cb7f 100755 --- a/chat/bitlbee/files/bitlbee.sh +++ b/chat/bitlbee/files/bitlbee.sh @@ -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 |