#! /bin/sh
# $Id: ezmlm-web-setup,v 1.1 1998/08/10 00:53:52 david Exp $
# Set up EZMLM-WEB for use by a particular user

# Setup configuration file names.
EZMLM_SUID="/etc/httpd/cgi-bin/ezmlm-web-index.cgi"
EZMLM_HTACCESS="/etc/httpd/cgi-bin/ezmlm-web-htaccess"

# Make sure web is accessable.
chmod a+x $HOME

# Make web directory
echo "Creating $HOME/public_html/lists"
mkdir -p $HOME/public_html/lists

# Set up authorization access.
echo "Setting up $HOME/public_html/lists/.htaccess"
sed -e "s;AUTHFILE;$HOME/.ezmlm-web-passwords;" < $EZMLM_HTACCESS > $HOME/public_html/lists/.htaccess

echo "Setting up $HOME/public_html/lists/index.cgi"
cp $EZMLM_SUID $HOME/public_html/lists/index.cgi
chmod ug+s $HOME/public_html/lists/index.cgi

if [ ! -f $HOME/.ezmlm-web-passwords ]; then
   echo "Please choose a password for your web access."
   /usr/sbin/htpasswd -c $HOME/.ezmlm-web-passwords $USER
 else
   echo "Please change password."
   /usr/sbin/htpasswd $HOME/.ezmlm-web-passwords $USER
fi
