Subject: pkg/33227: fixes and improvements for dict-server package
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Aleksey Cheusov <vle@gmx.net>
List: pkgsrc-bugs
Date: 04/09/2006 15:25:00
>Number:         33227
>Category:       pkg
>Synopsis:       fixes and improvements for dict-server package
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 09 15:25:00 +0000 2006
>Originator:     Aleksey Cheusov <cheusov@tut.by>
>Release:        NetBSD 3.0_STABLE
>Organization:
Best regards, Aleksey Cheusov.
>Environment:
System: NetBSD chen.chizhovka.net 3.0_STABLE NetBSD 3.0_STABLE (GENERIC) #2: Sun Mar 12 12:49:58 GMT 2006 cheusov@chen:/usr/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
fixes and improvements:
1) rc.d script is provided for dictd
2) group dictd and user dictd are created.
   They are necessary for dictd daemon.
3) MESSAGE file is provided
4) /var/log/dictd directory is created with appropriate permissions
5) post-patch section has been removed from Makefile.
   It is not necessary for years.
6) libltdl stuff has been removed. Under NetBSD it is not required.
   It should be optional depending on a platform.

Note: /var/run/dictd.pid is not created by dictd-1.9.15
      Later versions do. upgrade?

>How-To-Repeat:
>Fix:
Index: MESSAGE
===================================================================
RCS file: MESSAGE
diff -N MESSAGE
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ MESSAGE     9 Apr 2006 15:11:46 -0000
@@ -0,0 +1,19 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.6 2005/11/01 12:22:24 abs Exp $
+
+1) To enable "dictd" to start on boot on NetBSD-1.5 or newer,
+   please copy "${PREFIX}/${RCD_SCRIPTS_EXAMPLEDIR}/dictd" to
+   "/etc/rc.d/" and add "dictd=YES" to /etc/rc.conf. To do the
+   same on older systems, add the following to /etc/rc.local:
+
+   if [ -x ${PREFIX}/${RCD_SCRIPTS_EXAMPLEDIR}/dictd ]; then
+      ${PREFIX}/${RCD_SCRIPTS_EXAMPLEDIR}/dictd
+   fi
+
+2) By default dictd will log to syslog and use /usr/bin/m4 for
+   preprocessing configuration file. If you want to replace this default
+   add dictd_flags='<your options>' to /etc/rc.conf.
+
+3) ${VARBASE}/log/dictd is a preferred directory for logging.
+
+===========================================================================
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/textproc/dict-server/Makefile,v
retrieving revision 1.21
diff -u -r1.21 Makefile
--- Makefile    5 Feb 2006 23:11:00 -0000       1.21
+++ Makefile    9 Apr 2006 15:11:46 -0000
@@ -14,7 +14,16 @@
 USE_TOOLS+=            gmake
 GNU_CONFIGURE=         yes
 CONFIGURE_ARGS+=       --with-cflags=${CFLAGS:M*:Q}
-CONFIGURE_ARGS+=       --with-etcdir=${PKG_SYSCONFDIR:Q}
+
+MESSAGE_SUBST+=                VARBASE="${VARBASE}"
+
+PKG_GROUPS=     ${DICTD_GROUP}
+PKG_USERS=      ${DICTD_USER}:${DICTD_GROUP}::Dictionary\ protocol\ server\ user:/nonexistent:${NOLOGIN}
+
+RCD_SCRIPTS=    dictd
+
+# for -L /var/log/dictd/<filename_or_pattern>
+OWN_DIRS_PERMS=         ${VARBASE}/log/dictd ${DICTD_USER} ${DICTD_GROUP} 0750
 
 BUILD_TARGET=  dictd dictzip
 INSTALL_TARGET=        install.dictd install.dictzip install.dictfmt
@@ -23,22 +32,12 @@
 CONF_FILES=    ${EGDIR}/dictd.conf \
                ${PKG_SYSCONFDIR}/dictd.conf
 
-# A symbol T_USER is defined in trap.h so...
-post-patch:
-       ${GREP} -lr T_USER ${WRKSRC} | \
-       while read f; do \
-               ${MV} $$f $${f}.orig; \
-               ${SED}  -e 's/T_USER/T_XUSER/g' \
-                       -e 's/DICT_XUSER/DICT_USER/g' $${f}.orig >$$f; \
-       done
-
 post-install:
        ${INSTALL_DATA_DIR} ${EGDIR}
        ${SED} "s#/usr/lib/dict#${PREFIX}/share/dictd#" \
                ${WRKSRC}/dictd.conf >${EGDIR}/dictd.conf
        ${INSTALL_DATA_DIR} ${PREFIX}/share/dictd
 
-.include "../../devel/libltdl/buildlink3.mk"
 .include "../../devel/zlib/buildlink3.mk"
 
 .include "../../mk/bsd.pkg.mk"
Index: PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/textproc/dict-server/PLIST,v
retrieving revision 1.5
diff -u -r1.5 PLIST
--- PLIST       22 Feb 2005 16:10:03 -0000      1.5
+++ PLIST       9 Apr 2006 15:11:46 -0000
@@ -14,6 +14,7 @@
 man/man8/dictd.8
 sbin/dictd
 share/examples/dict-server/dictd.conf
+share/examples/rc.d/dictd
 @dirrm share/examples/dict-server
 @exec ${MKDIR} %D/share/dictd
 @dirrm share/dictd
Index: files/dictd.sh
===================================================================
RCS file: files/dictd.sh
diff -N files/dictd.sh
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ files/dictd.sh      9 Apr 2006 15:11:46 -0000
@@ -0,0 +1,19 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD$
+#
+# PROVIDE: dictd
+# REQUIRE: LOGIN
+
+. /etc/rc.subr
+
+name="dictd"
+dictd_flags=${dictd_flags-"-s --facility user --pp '/usr/bin/m4 -P'"}
+rcvar=$name
+command="@PREFIX@/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+required_files="@PKG_SYSCONFDIR@/dictd.conf"
+extra_commands="reload"
+
+load_rc_config $name
+run_rc_command "$1"