#!/bin/sh
# WARNING: This file was auto-generated. Do not edit!
EZPATH='/usr/bin'
# Should have a /bin/sh line and a define of EZPATH above
# set up during ``make''.

PROGNAME='ezmlm-glmake'
FATAL="${PROGNAME}: fatal:"
USAGE="${FATAL} ${PROGNAME} dir dot local host"

CAT='cat'
CUT='cut'
ECHO='echo'
LN='ln'
MKDIR='mkdir'
UMASK='umask'

if [ -z "$4" ] ; then
	${ECHO} $USAGE
	exit 100
fi

RES=`${ECHO} "$1" | ${CUT} -c1`
if [ "$RES" != "/" ]; then
	${ECHO} "$FATAL dir must start with slash"
	exit 100
fi

${UMASK} "027"
${MKDIR} "$1" || \
		{ ${ECHO} "$FATAL $? unable to make $1"; exit 100 ; }
${MKDIR} "$1/text" || \
		{ ${ECHO} "$FATAL unable to make $1/text"; exit 100 ; }
${ECHO} "$3" > "$1/inlocal" || \
		{ ${ECHO} "$FATAL unable to make $1/inlocal"; exit 100; }
${ECHO} "$3" > "$1/outlocal" || \
		{ ${ECHO} "$FATAL unable to make $1/outlocal"; exit 100; }
${ECHO} "$4" > "$1/outhost" || \
		{ ${ECHO} "$FATAL unable to make $1/outhost"; exit 100; }
${CAT} >"$1/headerremove"<<EOF
return-path
return-receipt-to
content-length
EOF
if [ "$?" != "0" ]; then
	${ECHO} "$FATAL unable to make $1/headerremove"; exit 100
fi

${CAT} >"$1/text/bottom"<<EOF

--- Administrative commands ---

Administrative functions of ezmlm mailing lists are done by
sending a message to the lists COMMAND address.

Please do not send the requests to the list address. If you do,
ezmlm will not see them and other subscribers will be annoyed.

To subscribe to any list "listname@hostname" send a message to:
   <listname-subscribe@hostname>

To get a complete list of commands for the same list, mail to:
   <listname-help@hostname>

--- Enclosed is a copy of the request I received.

EOF
if [ "$?" != "0" ]; then
	${ECHO} "$FATAL unable to make $1/text/bottom"; exit 100
fi

${CAT} >"$1/text/help"<<EOF
ezmlm mailing lists have an address for each command (see below).

I work at this address to make it easier for users used to other
mailing list managers to use ezmlm lists. I do this by reading the
first line of your message and doing my best to translate it into
a command message to the correct list. Usually, it is more efficient
for you to talk to the list directly.

In general, I accept and translate commands of the form:

command [listname] [username]

for instance:

subscribe listname

I also directly reply to:

lists [username]
which [username]

If username is omitted, your address will be used and the
reply will be sent to your address.

If listname does not contain a host name, I will look into my
list and try to add the correct host name. If I can't find it,
I will add the name of this computer. If listname contains a host
name, it must match a listname on my list. If not, I will
replace the host name with the name of this computer.

EOF
if [ "$?" != "0" ]; then
	${ECHO} "$FATAL unable to make $1/text/help"; exit 100
fi

${CAT} >"$1/text/top"<<EOF
Hi! This is the ezmlm program. I'm managing the
<#l#>@<#h#> address to guide
your request to the appropriate ezmlm mailing list.

EOF
if [ "$?" != "0" ]; then
	${ECHO} "$FATAL unable to make $1/text/top"; exit 100
fi

${CAT} >"$1/ezdomo"<<EOF
|${EZPATH}/ezmlm-request -f '$1/config.cf' '$1'
EOF
if [ "$?" != "0" ]; then
	${ECHO} "$FATAL unable to make $1/ezdomo"; exit 100
fi

${LN} -sf "$1/ezdomo" "$2" || \
	{ ${ECHO} "$FATAL unable to link $2 to $1/ezdomo"; exit 100 ; }
${LN} -sf "$1/ezdomo" "$2-default" || \
	{ ${ECHO} "$FATAL unable to link $2-default to $1/ezdomo"; exit 100 ; }


${ECHO}
${ECHO} "Remember to create $1/config.cf, manually or with:"
${ECHO} "ezmlm-glmake $2 > $1/config.cf"
${ECHO}

