1 # above should be a definition of EZPATH and the /bin/sh line
2 # automatically added at build time.
3 #########################################################################
4 # Script to build ezmlm-request config file for the global interface
5 # Lists are presented in alphabetical order and digest lists are
6 # directly after the main list. Digest list info is only that
7 # they are digest of the main list. If the -n switch is used,
8 # the current number of subscribers is added to the info text.
10 # Usage: ezmlm-glconf [-n] dotdir [dotdir1 ...] > config
11 # where ``dotdir'' is the directory where the users .qmail files
12 # reside (usually ``~''), and ``config'' is the config file for
13 # ezmlm-request servicing the global interface.
15 # Note: This config file will provide info on all lists available
16 # and allow ``which'' for all lists. You may want to edit the
17 # output before using it.
18 ##########################################################################
20 # Change if you change the name of the command
23 # Info text used for list-digest
25 # ``subscribers'' for stating subscriber number
27 # Info text if dir/text/info doesn't exist/is not readable
28 INFOTXT='No information available'
30 # Set full path if you use the script as root or if the commands
31 # are not in your path.
43 # Nothing more to configure
44 ##########################################################################
47 EZLIST="${EZPATH}/ezmlm-list"
48 FATAL="${NAME}: fatal: "
49 WARN="${NAME}: warning: "
50 USAGE="${NAME} [-n] dotdir [dotdir1 ...] > config"
52 if [ "$1" = "-n" ]; then
54 if [ ! -x "${EZLIST}" ]; then
55 echo "${WARN} ezmlm-list not found. Edit ezmlm binary path."
69 for i in `${LS} $1/.qmail-*-return-default` ; do
73 DIR=`${TAIL} -1 "$i" | ${CUT} -d\' -f2`
74 # only dir that exists
75 if [ -d "$DIR" ] ; then
76 INFOFN="${DIR}/text/info"
77 if [ -r "${INFOFN}" ]; then
78 INFO=`${HEAD} -1 ${INFOFN}`
81 ${ECHO} "$WARN No info for list in $DIR" 1>&2
84 OUTLOCAL=`${CAT} $DIR/outlocal`
85 OUTHOST=`${CAT} $DIR/outhost`
86 if [ -z "$SUB" ]; then
89 NO=`${EZLIST} ${DIR} | ${WC} -l |${SED} 's/ //g'`
90 SUBN=" (${NO} ${SUBTXT})"
92 ${ECHO} "$i" | ${GREP} 'digest-return' >/dev/null && \
93 { INFO="${DIGTXT} $OUTLOCAL@$OUTHOST."; \
94 OUTLOCAL="${OUTLOCAL}~digest" ; }
95 ${ECHO} "$OUTLOCAL@$OUTHOST:$DIR:${INFO}${SUBN}"
97 ${ECHO} "$WARN $DIR not readable - list ignored" 1>&2
100 ${ECHO} "$WARN $i ignored: doesn't point to readable file" 1>&2
105 ) | ${SORT} | ${SED} 's/~digest@/-digest@/'
106 # list-digest after list
107 # "~"-cludge needed to get order right