aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mailman-devel/pkg-install
diff options
context:
space:
mode:
authorwjv <wjv@FreeBSD.org>2002-10-29 22:29:33 +0800
committerwjv <wjv@FreeBSD.org>2002-10-29 22:29:33 +0800
commit8f31ccc707111adae3e3f3a03a9866f5f60ec9dc (patch)
treeb414d3ab65f81394266b6f8975c7af6ef836b3cf /mail/mailman-devel/pkg-install
parentd0e9db310a00cab7ac7c9d0c055fdecb83684944 (diff)
downloadfreebsd-ports-graphics-8f31ccc707111adae3e3f3a03a9866f5f60ec9dc.tar.gz
freebsd-ports-graphics-8f31ccc707111adae3e3f3a03a9866f5f60ec9dc.tar.zst
freebsd-ports-graphics-8f31ccc707111adae3e3f3a03a9866f5f60ec9dc.zip
Add mail/mailman-devel, the development version of the popular Mailman MLM.
Diffstat (limited to 'mail/mailman-devel/pkg-install')
-rw-r--r--mail/mailman-devel/pkg-install79
1 files changed, 79 insertions, 0 deletions
diff --git a/mail/mailman-devel/pkg-install b/mail/mailman-devel/pkg-install
new file mode 100644
index 00000000000..6fb4173e5fb
--- /dev/null
+++ b/mail/mailman-devel/pkg-install
@@ -0,0 +1,79 @@
+#! /bin/sh
+
+make_account() {
+ local u uid g gid gcos home shell
+
+ u=$1
+ uid=$2
+ g=$3
+ gid=$4
+ gcos=$5
+ home=$6
+ shell=$7
+
+ if pw group show "${g}" >/dev/null 2>&1; then
+ echo "You already have a group \"${g}\", so I will use it."
+ else
+ echo -n "Adding group \"${g}\" (${gid})... "
+ if which -s pw; then
+ pw groupadd ${g} -g ${gid} || exit
+ echo "done."
+ else
+ exit 1
+ fi
+ fi
+
+ if pw user show "${u}" >/dev/null 2>&1; then
+ echo "You already have a user \"${u}\", so I will use it."
+ else
+ echo -n "Adding user \"${u}\" (${uid})... "
+ if which -s pw; then
+ pw useradd ${u} -u ${uid} -g ${g} -h - -d ${home} \
+ -s ${shell} -c "${gcos}" || exit
+ echo "done."
+ else
+ exit 1
+ fi
+ fi
+
+ if [ x"$home" != x ]; then
+ if [ ! -d "${home}" ]; then
+ echo -n "Creating ${u}'s home directory (${home})... "
+ (umask 002 && mkdir -p ${home}) || exit
+ chown -R ${u}:${g} ${home} || exit
+ chmod g+s ${home} || exit
+ echo "done."
+ fi
+ fi
+}
+
+create_crontab() {
+ local u file
+
+ u=$1
+ file=$2
+
+ echo -n "Creating crontab(5) file for Mailman user... "
+ crontab -u ${u} ${file} || exit
+ echo "done."
+
+}
+
+fix_perms() {
+ echo -n "Checking (and fixing) permissions... "
+ %%MAILMANDIR%%/bin/check_perms -f >/dev/null 2>&1
+ echo "done."
+}
+
+case $2 in
+
+PRE-INSTALL)
+ make_account %%USER%% %%UID%% %%GROUP%% %%GID%% \
+ "Mailman User" "%%MAILMANDIR%%" "/sbin/nologin"
+ ;;
+
+POST-INSTALL)
+ create_crontab %%USER%% "%%MAILMANDIR%%/cron/crontab.in"
+ fix_perms
+ ;;
+esac