From 89971ee2ee1dc2ffc9bdd66234226f89483a110c Mon Sep 17 00:00:00 2001 From: pav Date: Tue, 31 Oct 2006 12:00:37 +0000 Subject: - Update to rc_subr startup script - Clean up REINPLACE_CMD usage - Use SUB_FILES - Deal with bopm.conf properly - Now uses /var/log/bopm for pid and logs, and more PR: ports/103555 Submitted by: Jeremy Chadwick Approved by: maintainer timeout (1 month) --- irc/bopm/files/bopm.in | 38 ++++++++++++++++++++++++++++++++ irc/bopm/files/bopm.sh.sample | 24 --------------------- irc/bopm/files/pkg-deinstall.in | 17 +++++++++++++++ irc/bopm/files/pkg-install.in | 48 +++++++++++++++++++++++++++++++++++++++++ irc/bopm/files/pkg-message.in | 13 +++++++++++ 5 files changed, 116 insertions(+), 24 deletions(-) create mode 100644 irc/bopm/files/bopm.in delete mode 100644 irc/bopm/files/bopm.sh.sample create mode 100644 irc/bopm/files/pkg-deinstall.in create mode 100644 irc/bopm/files/pkg-install.in create mode 100644 irc/bopm/files/pkg-message.in (limited to 'irc/bopm/files') diff --git a/irc/bopm/files/bopm.in b/irc/bopm/files/bopm.in new file mode 100644 index 000000000000..96bc4fb8c14c --- /dev/null +++ b/irc/bopm/files/bopm.in @@ -0,0 +1,38 @@ +#!/bin/sh + +# PROVIDE: bopm +# REQUIRE: DAEMON +# KEYWORD: shutdown + +# +# Add the following line to /etc/rc.conf to enable bopm: +# bopm_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable bopm. +# bopm_config (str): Default to "%%PREFIX%%/etc/bopm.conf" +# Configuration file for bopm. +# bopm_flags (str): Custom flags passed to the bopm +# daemon (default empty). +# +. %%RC_SUBR%% + +name="bopm" +rcvar=`set_rcvar` + +load_rc_config $name + +: ${bopm_enable="NO"} +: ${bopm_config="%%PREFIX%%/etc/bopm.conf"} +: ${bopm_flags=""} + +bopm_user="bopm" +pidfile="%%LOGDIR%%/bopm.pid" +required_files="${bopm_config}" + +# NOTE: bopm behaves differently with or without the -d flag. +# If you choose to use -d, you will probably need to redirect +# stdout and stderr to appropriate places. +# +command="%%PREFIX%%/bin/bopm" +command_args="${bopm_flags} &" + +run_rc_command "$1" diff --git a/irc/bopm/files/bopm.sh.sample b/irc/bopm/files/bopm.sh.sample deleted file mode 100644 index 5a2adbea0208..000000000000 --- a/irc/bopm/files/bopm.sh.sample +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -PREFIX=$(expr $0 : "\(/.*/\)etc/rc\.d/$(basename $0)\$") - -BOPM=${PREFIX}bin/bopm - -case "$1" in -start) - if [ -x $BOPM ]; then - su bopm -c $BOPM -d >/dev/null 2>&1 - echo -n ' bopm' - fi - ;; -stop) -# kill `cat ${PREFIX}/etc/ircd-hybrid-ru/ircd.pid` >/dev/null 2>&1 - killall bopm >/dev/null 2>&1 - echo -n ' bopm' - ;; -*) - echo "Usage: `basename $0` {start|stop}" >&2 - ;; -esac - -exit 0 diff --git a/irc/bopm/files/pkg-deinstall.in b/irc/bopm/files/pkg-deinstall.in new file mode 100644 index 000000000000..1efb18528816 --- /dev/null +++ b/irc/bopm/files/pkg-deinstall.in @@ -0,0 +1,17 @@ +#!/bin/sh + +#----------------------------------------------------------------------- +if [ "x$2" = "xPOST-DEINSTALL" ]; then +#----------------------------------------------------------------------- + +if [ -d %%LOGDIR%% ] +then + rm -f %%LOGDIR%%/bopm.pid 2>/dev/null + rmdir %%LOGDIR%% 2>/dev/null || echo "The logs in %%LOGDIR%% will remain untouched after the port is deinstalled." +fi + +#----------------------------------------------------------------------- +fi +#----------------------------------------------------------------------- + +exit 0 diff --git a/irc/bopm/files/pkg-install.in b/irc/bopm/files/pkg-install.in new file mode 100644 index 000000000000..10a5a457acaa --- /dev/null +++ b/irc/bopm/files/pkg-install.in @@ -0,0 +1,48 @@ +#!/bin/sh + +# This script is a modified copy of the pkg-install script +# from the ircd-hybrid-ru port. + +PATH=/bin:/usr/bin:/usr/sbin + +#----------------------------------------------------------------------- +if [ "x$2" = "xPRE-INSTALL" ]; then +#----------------------------------------------------------------------- + +USER=bopm +GROUP=${USER} +UID=717 +GID=${UID} +SHELL=/bin/sh +HOMEDIR=/nonexistent +GECOS="Blitzed Open Proxy Monitor" + +if pw group show "${GROUP}" 2>/dev/null; then + echo "You already have a group \"${GROUP}\", so I will use it." +else + if pw groupadd ${GROUP} -g ${GID}; then + echo "Added group \"${GROUP}\"." + else + echo "Adding group \"${GROUP}\" failed..." + exit 1 + fi +fi + +if pw user show "${USER}" 2>/dev/null; then + echo "You already have a user \"${USER}\", so I will use it." +else + if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \ + -d ${HOMEDIR} -s ${SHELL} -c "${GECOS}" + then + echo "Added user \"${USER}\"." + else + echo "Adding user \"${USER}\" failed..." + exit 1 + fi +fi + +#----------------------------------------------------------------------- +fi +#----------------------------------------------------------------------- + +exit 0 diff --git a/irc/bopm/files/pkg-message.in b/irc/bopm/files/pkg-message.in new file mode 100644 index 000000000000..ae25c2f16eb8 --- /dev/null +++ b/irc/bopm/files/pkg-message.in @@ -0,0 +1,13 @@ +----------------------------------------------------------------- +bopm has been installed. Here are some installation details: + +user bopm (uid 717) and group bopm (gid 717) have been added +to passwd(5) and group(5). + +bopm sample conf: %%PREFIX%%/etc/bopm.conf.sample +bopm rc script: %%PREFIX%%/etc/rc.d/bopm +bopm log dir: %%LOGDIR%% + +Please be sure to create %%PREFIX%%/etc/bopm.conf before +starting this daemon. +----------------------------------------------------------------- -- cgit