Subject: pkg/11977: apply "rc.d" start up script to japanese/canna-*
To: None <gnats-bugs@gnats.netbsd.org>
From: None <uebayasi@jp.netbsd.org>
List: netbsd-bugs
Date: 01/17/2001 07:39:16
>Number:         11977
>Category:       pkg
>Synopsis:       apply "rc.d" start up script to japanese/canna-*
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 17 07:39:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Masao Uebayashi
>Release:        1.5Q
>Organization:
Japan NetBSD Users Group
>Environment:
NetBSD takako 1.5Q NetBSD 1.5Q (TAKAKO) #0: Thu Jan 11 00:21:14 JST 2001     root@takako:/usr/src/sys/arch/i386/compile/TAKAKO i386
>Description:
If this applied, users have only to add a line "canna=YES" to
/etc/rc.conf, which seems to me easier and neater. :-)
>How-To-Repeat:
(apply the following patch)
$ cd (...)/pkgsrc/japanese/canna-server
$ make install
>Fix:
diff -Nru canna-lib.orig/files/canna.sh canna-lib/files/canna.sh
--- canna-lib.orig/files/canna.sh       Thu Jan  1 09:00:00 1970
+++ canna-lib/files/canna.sh    Wed Jan 17 23:20:09 2001
@@ -0,0 +1,25 @@
+#! /bin/sh
+#
+# $NetBSD$
+#
+# PROVIDE: canna
+# REQUIRE: DAEMON
+
+name="canna"
+command_start="@PREFIX@/sbin/cannaserver"
+pidfile=""
+
+cmd=${1:-start}
+
+case ${cmd} in
+start)
+    if [ -x ${command_start} ]; then
+        echo "Starting ${name}."
+        ${command_start} >/dev/null 2>&1
+    fi
+    ;;
+*)
+    :
+    ;;
+esac
+exit 0
diff -Nru canna-server.orig/Makefile canna-server/Makefile
--- canna-server.orig/Makefile  Fri Dec 15 12:27:04 2000
+++ canna-server/Makefile       Wed Jan 17 23:33:48 2001
@@ -38,9 +38,6 @@
                CANNA_SPOOL=${CANNA_SPOOL} CANNA_MODE=${CANNA_MODE} \
                DICT_DIR=${DICT_DIR} PREFIX=${PREFIX}
 
-STARTUP_SCRIPT=        etc/rc.d/canna.sh
-STARTUP_SCRIPT_SRC=${WRKDIR}/STARTUP
-
 INSTALL_TARGET=        instserver instclient
 
 post-patch:
@@ -54,16 +51,12 @@
        @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${XMKMF})
 
 post-build:
-       @${ECHO} '#!/bin/sh' > ${STARTUP_SCRIPT_SRC}
-       @${ECHO} 'canna=${PREFIX}/sbin/cannaserver' >> ${STARTUP_SCRIPT_SRC}
-       @${ECHO} 'if [ -f $$canna ]; then' >> ${STARTUP_SCRIPT_SRC}
-       @${ECHO} "    echo -n ' Canna'" >> ${STARTUP_SCRIPT_SRC}
-       @${ECHO} '     $$canna' >> ${STARTUP_SCRIPT_SRC}
-       @${ECHO} "fi" >> ${STARTUP_SCRIPT_SRC}
+       @${SED} -e 's|@PREFIX@|${PREFIX}|g' <${FILESDIR}/canna.sh \
+               >${WRKDIR}/canna.sh
 
 post-install:
        @${SH} ${PKGDIR}/INSTALL ${PKGNAME} POST-INSTALL
-       @${INSTALL_SCRIPT} ${STARTUP_SCRIPT_SRC} ${PREFIX}/${STARTUP_SCRIPT}
+       @${INSTALL_SCRIPT} ${WRKDIR}/canna.sh ${PREFIX}/etc/rc.d/canna.sh
        @${MKDIR} ${CANNA_SPOOL}
        @${CHMOD} ${CANNA_MODE} ${CANNA_SPOOL}
        @${CHOWN} ${CANNAOWNER}:${CANNAGROUP} ${CANNA_SPOOL}
>Release-Note:
>Audit-Trail:
>Unformatted: