From 090b89bf04e16bcf7b0c01983e694b5baaecfaef Mon Sep 17 00:00:00 2001 From: jlam Date: Wed, 21 Nov 2001 15:14:01 +0000 Subject: Buildlinkify and use general INSTALL/DEINSTALL scripts. Also modify rc.d script to respect ${CONFDIR} and look more like other 1.5-release rc.d scripts. --- security/pks/DEINSTALL | 27 ------------ security/pks/INSTALL | 30 -------------- security/pks/Makefile | 26 ++++++++---- security/pks/files/pksd.sh | 100 ++++++++++++++++++++++++++++----------------- 4 files changed, 81 insertions(+), 102 deletions(-) delete mode 100644 security/pks/DEINSTALL delete mode 100644 security/pks/INSTALL (limited to 'security/pks') diff --git a/security/pks/DEINSTALL b/security/pks/DEINSTALL deleted file mode 100644 index 93bc3d0ac2c..00000000000 --- a/security/pks/DEINSTALL +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# -# $NetBSD: DEINSTALL,v 1.1 2001/11/01 01:17:32 zuntum Exp $ - -PKGNAME=$1 -STAGE=$2 - -case ${STAGE} in -DEINSTALL) - ;; -POST-DEINSTALL) - cat << EOF -=========================================================================== -If you won't be using ${PKGNAME} any longer, you may want to remove the -following directories and files: - - /etc/pksd.conf - /var/pks -=========================================================================== -EOF - ;; -*) - echo "Unexpected argument: ${STAGE}" - exit 1 - ;; -esac -exit 0 diff --git a/security/pks/INSTALL b/security/pks/INSTALL deleted file mode 100644 index b9484e800bb..00000000000 --- a/security/pks/INSTALL +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# -# $NetBSD: INSTALL,v 1.1 2001/11/01 01:17:32 zuntum Exp $ - -PKGNAME=$1 -STAGE=$2 - -case ${STAGE} in -PRE-INSTALL) - ;; -POST-INSTALL) - DBDIR=/var/pks/db - MAILDIR=/var/pks/incoming - EXAMPLE_DIR=${PKG_PREFIX}/share/examples - INSTALL_DATA="/usr/bin/install -c -o root -g wheel -m 0644" - - mkdir -p ${DBDIR} ${MAILDIR} - - if [ ! -f /etc/pksd.conf ] - then - echo "Installing example pksd.conf as /etc/pksd.conf." - ${INSTALL_DATA} ${EXAMPLE_DIR}/pksd.conf /etc/pksd.conf - fi - ;; -*) - echo "Unexpected argument: ${STAGE}" - exit 1 - ;; -esac -exit 0 diff --git a/security/pks/Makefile b/security/pks/Makefile index c3fd69e34ff..2ba54461767 100644 --- a/security/pks/Makefile +++ b/security/pks/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.5 2001/09/27 23:18:40 jlam Exp $ +# $NetBSD: Makefile,v 1.6 2001/11/21 15:14:02 jlam Exp $ DISTNAME= pks-0.9.4 CATEGORIES= security www @@ -15,19 +15,29 @@ MAINTAINER= burgess@neonramp.com HOMEPAGE= http://www.mit.edu/people/marc/pks/ COMMENT= PGP Public Key Server -DEPENDS+= db-[0-9]*:../../databases/db - -GNU_CONFIGURE= # defined +USE_BUILDLINK_ONLY= YES +GNU_CONFIGURE= YES CONFIGURE_ARGS+= --datadir=${PREFIX}/share/pks CONFIGURE_ARGS+= --localstatedir=/var/pks -CONFIGURE_ARGS+= --sysconfdir=${PREFIX}/share/examples +# +# pksd doesn't actually look for it's config file anywhere; it must be +# specified directly on the command-line. Setting sysconfdir here just +# causes the example pksd.conf file to be installed at the named location. +# +CONFIGURE_ARGS+= --sysconfdir=${EGDIR} + +EGDIR= ${PREFIX}/share/examples +CONF_FILES= ${EGDIR}/pksd.conf ${CONFDIR}/pksd.conf +RCD_SCRIPTS= ${PREFIX}/etc/rc.d/pksd /etc/rc.d/pksd +OWN_DIRS= /var/pks /var/pks/db /var/pks/incoming -post-build: - ${SED} -e "s,@PREFIX@,${PREFIX},g" \ - < ${FILESDIR}/pksd.sh > ${WRKDIR}/pksd.sh +pre-install: + ${SED} ${FILES_SUBST_SED} ${FILESDIR}/pksd.sh > ${WRKDIR}/pksd.sh post-install: ${INSTALL_SCRIPT} ${WRKDIR}/pksd.sh ${PREFIX}/etc/rc.d/pksd PKG_PREFIX=${PREFIX} ${SH} ${INSTALL_FILE} ${PKGNAME} POST-INSTALL +.include "../../databases/db/buildlink.mk" +.include "../../mk/bsd.pkg.install.mk" .include "../../mk/bsd.pkg.mk" diff --git a/security/pks/files/pksd.sh b/security/pks/files/pksd.sh index 6c5849446bf..a07473542da 100644 --- a/security/pks/files/pksd.sh +++ b/security/pks/files/pksd.sh @@ -1,52 +1,78 @@ #!/bin/sh # -# $NetBSD: pksd.sh,v 1.2 2000/09/20 05:14:12 jlam Exp $ +# $NetBSD: pksd.sh,v 1.3 2001/11/21 15:14:02 jlam Exp $ # # PROVIDE: pksd # REQUIRE: DAEMON +if [ -d /etc/rc.d -a -f /etc/rc.subr ] +then + . /etc/rc.subr +fi + name="pksd" -command=${1:-start} +rcvar=${name} -case ${command} in -start) - if [ ! -f /etc/${name}.conf ] - then - exit 0 - else - dbdir=`awk '/db_dir/ { print $2 }' < /etc/${name}.conf` - fi - if [ ! -f ${dbdir}/keydb000 -a -x @PREFIX@/bin/pksclient ] +command="@PREFIX@/bin/pksd" +run_command="@PREFIX@/bin/pks-queue-run.sh" +ctl_command="@PREFIX@/bin/pksdctl" +client_command="@PREFIX@/bin/pksclient" + +conf_file="@CONFDIR@/${name}.conf" +required_files="${conf_file}" +extra_commands="dbinit" + +pksd_dbinit() +{ + ( + umask 022 + if [ -r ${conf_file} ] then - @PREFIX@/bin/pksclient ${dbdir} create + dbdir=`@AWK@ '/db_dir/ { print $2 }' < ${conf_file}` + if [ ! -f ${dbdir}/keydb000 -a -x ${client_command} ] + then + ${client_command} ${dbdir} create + fi fi - if [ -x @PREFIX@/bin/${name} -a -x @PREFIX@/bin/pks-queue-run.sh ] + ) +} + +pksd_start() +{ + if [ -r ${conf_file} -a -x ${command} -a -x ${run_command} ] then - echo "Starting ${name}." - @PREFIX@/bin/${name} /etc/${name}.conf & + @ECHO@ "Starting ${name} (local)." + @ECHO@ "${command} ${conf_file}" + ${command} ${conf_file} & sleep 5 - @PREFIX@/bin/pks-queue-run.sh /etc/${name}.conf + ${run_command} ${conf_file} fi - ;; -stop) - if [ ! -f /etc/${name}.conf ] - then - exit 0 - else - socket=`awk '/socket_name/ { print $2 }' < /etc/${name}.conf` - fi - if [ -x @PREFIX@/bin/${name}ctl -a -S ${socket} ] +} + +pksd_stop() +{ + if [ -r ${conf_file} -a -x ${ctl_command} ] then - echo "Stopping ${name}." - @PREFIX@/bin/${name}ctl ${socket} shutdown - else - echo "couldn't stop ${name}." + socket=`@AWK@ '/socket_name/ { print $2 }' < ${conf_file}` + if [ -S ${socket} ] + then + @ECHO@ "Stopping ${name} (local)." + ${ctl_command} ${socket} shutdown + fi fi - ;; -restart) - ( $0 stop ) - sleep 1 - $0 start - ;; -esac -exit 0 +} + +dbinit_cmd=pksd_dbinit +start_precmd=pksd_dbinit +start_cmd=pksd_start +stop_cmd=pksd_stop + +if [ ! -d /etc/rc.d ] +then + @ECHO@ -n " ${name}" + pksd_dbinit + pksd_start +else + load_rc_config $name + run_rc_command "$1" +fi -- cgit v1.2.3