summaryrefslogtreecommitdiffstats
path: root/mail/sqlgrey/files
diff options
context:
space:
mode:
authormat <mat@FreeBSD.org>2005-02-18 11:39:31 +0000
committermat <mat@FreeBSD.org>2005-02-18 11:39:31 +0000
commit27f615f9d69689191c0734537626164410bd4755 (patch)
tree512511336d08dd95804bba46747b9cace0de0967 /mail/sqlgrey/files
parentdaaa6f614d811dbbcbe28dacd0f85c15ce3ba448 (diff)
downloadFreeBSD-ports-27f615f9d69689191c0734537626164410bd4755.zip
FreeBSD-ports-27f615f9d69689191c0734537626164410bd4755.tar.gz
Add sqlgrey 1.4.5, greylisting policy server for Postfix using an SQL backend.
Diffstat (limited to 'mail/sqlgrey/files')
-rw-r--r--mail/sqlgrey/files/pkg-install.in61
-rw-r--r--mail/sqlgrey/files/sqlgrey.sh.in46
2 files changed, 107 insertions, 0 deletions
diff --git a/mail/sqlgrey/files/pkg-install.in b/mail/sqlgrey/files/pkg-install.in
new file mode 100644
index 0000000..f3e8b1e
--- /dev/null
+++ b/mail/sqlgrey/files/pkg-install.in
@@ -0,0 +1,61 @@
+#! /bin/sh
+#
+# $FreeBSD$
+
+PATH=/bin:/usr/bin:/usr/sbin
+
+case $2 in
+
+ POST-INSTALL)
+
+ echo "---> Starting install script:"
+
+ if [ -z "%%USER%%" -o -z "%%GROUP%%" ]; then
+ echo "ERROR: A required pragma was empty"
+ exit 1
+ fi
+
+ # Create group if required
+ if /usr/sbin/pw group show "%%GROUP%%" >/dev/null 2>&1; then
+ echo "---> Using existing group \"%%GROUP%%\""
+ else
+ echo "---> Adding group \"%%GROUP%%\""
+ /usr/sbin/pw groupadd %%GROUP%% || exit 1
+ fi
+
+ # Create user if required
+ if /usr/sbin/pw user show "%%USER%%" >/dev/null 2>&1; then
+ echo "---> Using existing user \"%%USER%%\""
+ else
+ echo "---> Adding user \"%%USER%%\""
+ /usr/sbin/pw useradd "%%USER%%" -g "%%GROUP%%" -h - \
+ -d "%%DATADIR%%" -s "/sbin/nologin" -c "Postgrey Owner" || exit 1
+ fi
+
+ # Create home directory if required
+ if [ -d "%%DATADIR%%" ]; then
+ echo "---> Using existing Postgrey database directory (%%DATADIR%%)"
+ echo " (There may be existing active postgrey databases - this installation"
+ echo " will attempt to preserve them.)"
+ else
+ echo "---> Creating Postgrey database directory (%%DATADIR%%)"
+ (umask 002 && /bin/mkdir -p "%%DATADIR%%") || exit 1
+ /usr/sbin/chown -R "%%USER%%:%%GROUP%%" "%%DATADIR%%" || exit 1
+ /bin/chmod g+s "%%DATADIR%%" || exit 1
+ fi
+ ;;
+
+ POST-DEINSTALL)
+
+ echo "---> Please, remember to remove the user and the group with :"
+ if /usr/sbin/pw user show "%%USER%%" >/dev/null 2>&1; then
+ echo " /usr/sbin/pw userdel -n %%USER%%"
+ fi
+ if /usr/sbin/pw group show "%%GROUP%%" >/dev/null 2>&1; then
+ echo " /usr/sbin/pw groupdel -n %%GROUP%%"
+ fi
+ echo " as well as the databases."
+ echo " If you're only updating, you can leave the things as they are."
+ ;;
+
+esac
diff --git a/mail/sqlgrey/files/sqlgrey.sh.in b/mail/sqlgrey/files/sqlgrey.sh.in
new file mode 100644
index 0000000..02f26b4
--- /dev/null
+++ b/mail/sqlgrey/files/sqlgrey.sh.in
@@ -0,0 +1,46 @@
+#!/bin/sh
+# $FreeBSD$
+#
+
+# PROVIDE: sqlgrey
+# REQUIRE: LOGIN
+# BEFORE: mail
+# KEYWORD: FreeBSD shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable sqlgrey:
+#
+# sqlgrey_enable="YES"
+#
+# See man sqlgrey for flags or the config file.
+#
+
+. %%RC_SUBR%%
+
+name=sqlgrey
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/sbin/sqlgrey
+extra_commands=reload
+
+stop_postcmd=stop_postcmd
+
+stop_postcmd()
+{
+ rm -f $pidfile
+}
+
+# set defaults
+
+sqlgrey_enable=${sqlgrey_enable:-"NO"}
+sqlgrey_pidfile=${sqlgrey_pidfile:-"/var/run/sqlgrey.pid"}
+sqlgrey_listen=${sqlgrey_listen:-"2501"}
+sqlgrey_config=${sqlgrey_config:-"/usr/local/etc/sqlgrey.conf"}
+sqlgrey_flags=${sqlgrey_flags:-"--pidfile=${sqlgrey_pidfile} \
+ --inet=${sqlgrey_listen} --daemonize --user=sqlgrey --group=sqlgrey \
+ --configfile=${sqlgrey_config}"}
+
+pidfile="${sqlgrey_pidfile}"
+
+load_rc_config $name
+run_rc_command "$1"
OpenPOWER on IntegriCloud