summaryrefslogtreecommitdiff
path: root/adduser.local
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2005-12-20 01:10:56 +0000
committerJonas Smedegaard <dr@jones.dk>2005-12-20 01:10:56 +0000
commit02517b89114aa6faa583931c38a26ea359e86be9 (patch)
treefa28b3c40adfe2aae00c4b946418235d8ece8fcc /adduser.local
parent318972c503849ca50a1fb62217ae713973108a43 (diff)
Much improved mailinglist handling.
Diffstat (limited to 'adduser.local')
-rwxr-xr-xadduser.local31
1 files changed, 14 insertions, 17 deletions
diff --git a/adduser.local b/adduser.local
index 595d0f2..a67e8e9 100755
--- a/adduser.local
+++ b/adduser.local
@@ -3,7 +3,7 @@
# /usr/local/sbin/adduser.local
# Copyright 2001-2002 Jonas Smedegaard <dr@jones.dk>
#
-# $Id: adduser.local,v 1.17 2004-09-25 21:00:06 jonas Exp $
+# $Id: adduser.local,v 1.18 2005-12-20 01:10:56 jonas Exp $
#
# Common adduser additions for Spiff and Xenux networks
#
@@ -19,6 +19,12 @@ NEWUID=$2
NEWGID=$3
NEWHOMEDIR=$4
+function fullname() { getent passwd $NEWUSERNAME | awk -F: '{print $5}' | awk -F, '{print $1}'; }
+function maildomain() { if [ -r /etc/mailname ]; then head -n 1 /etc/mailname; else hostname -d; fi; }
+
+function listlists() { if [ -x /usr/sbin/list_lists ]; then /usr/sbin/list_lists -ab; fi; }
+function add2list() { /bin/echo "`fullname` <$NEWUSERNAME@`maildomain`>" | /usr/sbin/add_members -w y -a y -r - $1; }
+
. /etc/adduser.conf
# Ignore non-human accounts silently
@@ -63,22 +69,13 @@ if [ -x /usr/local/sbin/userforward ]; then
fi
# Mailing lists
-#FIXME: Be more generic - support other mailinglists than mailman!
-listdir="/var/lib/mailman/lists"
-lists=""
-[ -d $listdir ] && \
- lists=`find $listdir -type d -mindepth 1 -maxdepth 1 -exec basename '{}' \;`
-for list in $lists; do
- if [ -d $listdir/$list -a -x /usr/sbin/add_members ]; then
- echo -n "Subscribe to mailinglist $list (y/N)? "
- read subscribe
- case $subscribe in
- y|Y)
- /bin/echo $NEWUSERNAME@`hostname -d` \
- | /usr/sbin/add_members -w y -a y -r - $list
- ;;
- esac
- fi
+for list in `listlists`; do
+ echo -n "Subscribe to mailinglist $list (y/N)? "
+ read subscribe
+ case $subscribe in
+ y|Y)
+ add2list $list;;
+ esac
done
if [ -f /etc/local/users.conf ]; then