aboutsummaryrefslogtreecommitdiff
path: root/mail/mailman/pkg-install
diff options
context:
space:
mode:
authorJohann Visagie <wjv@FreeBSD.org>2003-01-23 12:49:00 +0000
committerJohann Visagie <wjv@FreeBSD.org>2003-01-23 12:49:00 +0000
commit9fb9d105a9c0255450b8a3a4ecf4b6d455380260 (patch)
tree437c0e6fc72787701719011aa7baecaf4222cbf3 /mail/mailman/pkg-install
parent451c213b4b84f1dcd51cbe828152b80a486535f3 (diff)
Notes
Diffstat (limited to 'mail/mailman/pkg-install')
-rw-r--r--mail/mailman/pkg-install100
1 files changed, 39 insertions, 61 deletions
diff --git a/mail/mailman/pkg-install b/mail/mailman/pkg-install
index f6db5b956fa5..214bf3df6499 100644
--- a/mail/mailman/pkg-install
+++ b/mail/mailman/pkg-install
@@ -2,80 +2,58 @@
#
# $FreeBSD$
-make_account() {
- local u uid g gid gcos home shell
+PATH=/bin:/usr/bin:/usr/sbin
- u=$1
- uid=$2
- g=$3
- gid=$4
- gcos=$5
- home=$6
- shell=$7
+case $2 in
- 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
+PRE-INSTALL)
+ echo "---> Starting install script:"
+
+ if [ -z "%%MAILMANDIR%%" -o \
+ -z "%%USER%%" -o -z "%%GROUP%%" -o \
+ -z "%%UID%%" -o -z "%%GID%%" ]; then
+ echo "ERROR: A required pragma was empty"
+ exit 1
fi
- if pw user show "${u}" >/dev/null 2>&1; then
- echo "You already have a user \"${u}\", so I will use it."
+ # Create group if required
+ if pw group show "%%GROUP%%" >/dev/null 2>&1; then
+ echo "---> Using existing group \"%%GROUP%%\""
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
+ echo "---> Adding group \"%%GROUP%%\" (%%GID%%)"
+ /usr/sbin/pw groupadd %%GROUP%% -g %%GID%% || exit 1
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
+ # Create user if required
+ if pw user show "%%USER%%" >/dev/null 2>&1; then
+ echo "---> Using existing user \"%%USER%%\""
+ else
+ echo "---> Adding user \"%%USER%%\" (%%UID%%)"
+ pw useradd "%%USER%%" -u "%%UID%%" -g "%%GROUP%%" -h - \
+ -d "%%MAILMANDIR%%" -s "/sbin/nologin" -c "Mailman Owner" || exit 1
fi
-}
-
-create_crontab() {
- local u file
- u=$1
- file=$2
+ # Create home directory if required
+ if [ -d "%%MAILMANDIR%%" ]; then
+ echo "---> Using existing Mailman directory (%%MAILMANDIR%%)"
+ echo " (There may be existing active mailing lists - this installation will"
+ echo " attempt to preserve them.)"
+ else
+ echo "---> Creating Mailman directory (%%MAILMANDIR%%)"
+ (umask 002 && /bin/mkdir -p "%%MAILMANDIR%%") || exit 1
+ /usr/sbin/chown -R "%%USER%%:%%GROUP%%" "%%MAILMANDIR%%" || exit 1
+ /bin/chmod g+s "%%MAILMANDIR%%" || exit 1
+ fi
+ ;;
- echo -n "Creating crontab(5) file for Mailman user... "
- crontab -u ${u} ${file} || exit
- echo "done."
+POST-INSTALL)
+ echo "---> Starting post-install script:"
-}
+ echo "---> Creating crontab(5) file for user \"%%USER%%\""
+ /usr/bin/crontab -u "%%USER%%" "%%MAILMANDIR%%/cron/crontab.in" || exit 1
-fix_perms() {
- echo -n "Checking (and fixing) permissions... "
+ echo "---> Checking (and fixing) file and directory 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