summaryrefslogtreecommitdiff
path: root/irc/bopm
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2006-10-31 12:00:37 +0000
committerPav Lucistnik <pav@FreeBSD.org>2006-10-31 12:00:37 +0000
commit1af9d66933414386014d2834a482df29817ba6ea (patch)
tree2e041e6f405e184752029cfb26df431defe5eb96 /irc/bopm
parentUpdate to the 20061026 snapshot of GCC 4.0.4. (diff)
- 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 <freebsd@jdc.parodius.com> Approved by: maintainer timeout (1 month)
Notes
Notes: svn path=/head/; revision=175790
Diffstat (limited to 'irc/bopm')
-rw-r--r--irc/bopm/Makefile38
-rw-r--r--irc/bopm/files/bopm.in38
-rw-r--r--irc/bopm/files/bopm.sh.sample24
-rw-r--r--irc/bopm/files/pkg-deinstall.in17
-rw-r--r--irc/bopm/files/pkg-install.in48
-rw-r--r--irc/bopm/files/pkg-message.in13
-rw-r--r--irc/bopm/pkg-deinstall54
-rw-r--r--irc/bopm/pkg-descr12
-rw-r--r--irc/bopm/pkg-install68
-rw-r--r--irc/bopm/pkg-message17
-rw-r--r--irc/bopm/pkg-plist8
11 files changed, 153 insertions, 184 deletions
diff --git a/irc/bopm/Makefile b/irc/bopm/Makefile
index 07e857c4ed19..2de7ead0e7a8 100644
--- a/irc/bopm/Makefile
+++ b/irc/bopm/Makefile
@@ -7,28 +7,46 @@
PORTNAME= bopm
PORTVERSION= 3.1.2
+PORTREVISION= 1
CATEGORIES= irc
MASTER_SITES= http://static.blitzed.org/www.blitzed.org/bopm/files/ \
ftp://rusunix.org/pub/FreeBSD/distfiles/
MAINTAINER= aquatique-ports@rambler.ru
-COMMENT= Open proxy monitor and blocker, designed for use with ircds
+COMMENT= Open proxy and DNSBL monitor, designed for use with ircds
-GNU_CONFIGURE= yes
-CONFIGURE_TARGET=--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
-CONFIGURE_ARGS= --sysconfdir=${PREFIX}/etc
+LOGDIR= /var/log/${PORTNAME}
+
+GNU_CONFIGURE= yes
+CONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
+CONFIGURE_ARGS= --sysconfdir=${PREFIX}/etc --localstatedir=${LOGDIR}
USE_LDCONFIG= yes
+USE_RC_SUBR= bopm
-post-patch:
- @${REINPLACE_CMD} -e 's,^[[:space:]]*$$(mkinstalldirs) $$(localstatedir),,' ${WRKSRC}/Makefile.in
- @${REINPLACE_CMD} -e 's,= bopm.conf.sample,= ,' ${WRKSRC}/Makefile.in
+SUB_FILES= pkg-message pkg-install pkg-deinstall
+PLIST_SUB= LOGDIR=${LOGDIR}
+SUB_LIST= LOGDIR=${LOGDIR}
-pre-install:
- @${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
+pre-su-install:
+ @${SETENV} "PKG_PREFIX=${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
+
+post-patch:
+ @${REINPLACE_CMD} \
+ -e 's,data_DATA = bopm.conf.sample,data_DATA =,g' \
+ -e 's,$(sysconfdir)/bopm.conf,$(sysconfdir)/bopm.conf.sample,g' \
+ ${WRKSRC}/Makefile.in
+ @${REINPLACE_CMD} \
+ -e 's,/some/path/bopm.pid,${LOGDIR}/bopm.pid,g' \
+ -e 's,/some/path/scan.log,${LOGDIR}/scan.log,g' \
+ ${WRKSRC}/bopm.conf.sample
post-install:
- @${INSTALL_SCRIPT} -m 555 ${FILESDIR}/bopm.sh.sample ${PREFIX}/etc/rc.d
+ @${SETENV} "PKG_PREFIX=${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+ @${CHOWN} bopm:bopm ${LOGDIR}
+ @${CHMOD} 750 ${LOGDIR}
+ @${CHOWN} bopm:bopm ${PREFIX}/etc/bopm.conf.sample
+ @${CHMOD} 640 ${PREFIX}/etc/bopm.conf.sample
@${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>
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.
+-----------------------------------------------------------------
diff --git a/irc/bopm/pkg-deinstall b/irc/bopm/pkg-deinstall
deleted file mode 100644
index 9c309af31bbc..000000000000
--- a/irc/bopm/pkg-deinstall
+++ /dev/null
@@ -1,54 +0,0 @@
-#! /bin/sh
-
-ask() {
- local question default answer
-
- question=$1
- default=$2
- if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
- read -p "${question} [${default}]? " answer
- fi
- echo ${answer:-${default}}
-}
-
-yesno() {
- local question default answer
-
- question=$1
- default=$2
- while :; do
- answer=$(ask "${question}" "${default}")
- case "${answer}" in
- [Yy]*) return 0;;
- [Nn]*) return 1;;
- esac
- echo "Please answer yes or no."
- done
-}
-
-delete_account() {
- local u
-
- u=$1
- if yesno "Do you want me to remove user \"${u}\"" n; then
- pw userdel -n ${u}
- echo "Done."
- fi
-}
-
-case $2 in
-
-DEINSTALL)
- if ps -axc | grep -qw bopm; then
- if yesno "bopm is still running. Shall I stop it?" y; then
- killall bopm
- sleep 2
- else
- echo "OK ... I hope you know what you are doing."
- fi
- fi
-
- delete_account bopm
- ;;
-
-esac
diff --git a/irc/bopm/pkg-descr b/irc/bopm/pkg-descr
index a5a5d961513a..df58c06f4006 100644
--- a/irc/bopm/pkg-descr
+++ b/irc/bopm/pkg-descr
@@ -1,7 +1,7 @@
- bopm is an open-source open proxy monitor, designed for use
- with hybrid-based ircds, although it can be used with slight
- modification on any server which has +c to show connects to
- opers and that supports KLINEs in order to K-LINE incoming
- connects from open proxies
+bopm is an open-source proxy monitor, designed for use
+with IRC daemons such as Bahamut, Hybrid/ratbox, Unreal,
+Dancer, and any other which supports +c to show client
+connects to opers; bopm will KLINE clients it considers
+on an open proxy. bopm also supports DNSBL lookups.
-WWW: http://blitzed.org/bopm/
+WWW: http://wiki.blitzed.org/BOPM
diff --git a/irc/bopm/pkg-install b/irc/bopm/pkg-install
deleted file mode 100644
index 0bbc7de7346e..000000000000
--- a/irc/bopm/pkg-install
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/sh
-
-# This script is a modified copy of the pkg-install script
-# from the ircd-hybrid-ru port.
-
-if [ "x$2" != "xPRE-INSTALL" ]; then
- exit 0;
-fi
-
-
-if ! which -s pw ; then
- cat <<EOF
-Your system does not include the "pw" utility. You should upgrade
-to a newer version of FreeBSD. Without "pw" this script will not
-run.
-EOF
- exit 1
-fi
-
-uid=717
-user=bopm
-gid=$uid
-group=$user
-gecos="Blitzed Open Proxy Monitor"
-shell="/bin/sh"
-home="/nonexistent"
-
-echo ""
-if pw groupshow $group 2> /dev/null ; then
- echo "You already have a group \"$group\", so I will use it."
-else
- if pw groupshow $gid 2> /dev/null ; then
- echo "You already have a gid \"$gid\". Please create a user \"$group\""
- echo "with a default group of \"$group\"."
- exit 1
- fi
- echo "You need a group \"$group\"."
- if which -s pw ; then
- pw groupadd $group -g $gid || exit
- echo "Done."
- else
- echo "Please create it, and try again."
- if ! pw usershow $user 2> /dev/null ; then
- echo "While you're at it, please create a user \"$user\""
- echo 'too, with a default group of "$group".'
- fi
- exit 1
- fi
-fi
-
-if pw usershow $user 2> /dev/null ; then
- echo "You already have a user \"$user\", so I will use it."
-else
- if pw usershow $uid 2> /dev/null ; then
- echo "You already have a uid \"$uid\". Please create a user \"$user\""
- echo "with a default group of \"$group\"."
- exit 1
- fi
- echo "You need a user \"$user\"."
- if which -s pw; then
- pw useradd $user -g $group -u $uid -h - -d $home \
- -s "$shell" -c "$gecos" || exit
- echo "Done."
- else
- echo "Please create it, and try again."
- exit 1
- fi
-fi
diff --git a/irc/bopm/pkg-message b/irc/bopm/pkg-message
deleted file mode 100644
index 2afc1b09d46b..000000000000
--- a/irc/bopm/pkg-message
+++ /dev/null
@@ -1,17 +0,0 @@
-
-----------------------------------------------------
-
-This port uses now UID/GID - 717
-
-bopm has been installed.
-
-This port create user bopm and group bopm
-
-You should now edit bopm.conf it to suit your needs.
-
-You may then start the bopm by running:
- cd /usr/local/etc/rc.d/ && \
- cp bopm.sh.sample bopm.sh && \
- /usr/local/etc/rc.d/bopm.sh start
-
-----------------------------------------------------
diff --git a/irc/bopm/pkg-plist b/irc/bopm/pkg-plist
index f49f9a7a9996..8992f2d19271 100644
--- a/irc/bopm/pkg-plist
+++ b/irc/bopm/pkg-plist
@@ -1,6 +1,7 @@
+@unexec /bin/echo "===>" Stopping bopm...
+@unexec /usr/bin/killall bopm 2>/dev/null || true
bin/bopm
-etc/bopm.conf
-etc/rc.d/bopm.sh.sample
+etc/bopm.conf.sample
include/opm.h
include/opm_error.h
include/opm_types.h
@@ -9,6 +10,3 @@ lib/libopm.so.0
lib/libopm.so
lib/libopm.la
lib/libopm.a
-@exec mkdir -m 755 /var/log/bopm
-@exec chown bopm:bopm /var/log/bopm
-@dirrmtry var/log/bopm