#!/bin/sh
if [ -r /tmp/SeTT_PX ]; then
 T_PX="`cat /tmp/SeTT_PX`"
elif [ ! "$1" = "" ]; then
 T_PX=$1
else
 T_PX=/
fi
if [ -d /mnt/cdrom/usr/src/sendmail ]; then
 CONFIGDIR=/mnt/cdrom/usr/src/sendmail
elif [ -d /cdrom/usr/src/sendmail ]; then
 CONFIGDIR=/cdrom/usr/src/sendmail
elif [ -d /mnt/usr/src/sendmail ]; then
 CONFIGDIR=/mnt/usr/src/sendmail
elif [ -d /usr/src/sendmail ]; then
 CONFIGDIR=/usr/src/sendmail
elif [ -d /mnt/linux/usr/src/sendmail ]; then
 CONFIGDIR=/mnt/linux/usr/src/sendmail
elif [ -d /mnt/linux/cdrom/usr/src/sendmail ]; then
 CONFIGDIR=/mnt/linux/cdrom/usr/src/sendmail
else
 echo "The directory that is supposed to contain your sendmail"
 echo "config files is missing. (something like /usr/src/sendmail...)"
 echo "Sorry :^)"
 exit # where the #$^* are the files??
fi
if [ "$COLOR" = "on" -o -r /tmp/SeTcolor ]; then # use color menus
 dialog --title "SENDMAIL CONFIGURATION" --menu "Sendmail requires a \
configuration file (/etc/sendmail.cf). Three versions are provided: \
TCP/IP with a nameserver, TCP/IP without a nameserver, and UUCP. If \
none of these proves suitable, you can make your own (look in \
/usr/src/sendmail). It probably won't hurt to try one of these, though." \
15 70 4 \
"SMTP+BIND" "Connected to the net with nameserver access" \
"SMTP" "Connected to a network with no nameserver" \
"UUCP" "Use UUCP for mail transmission" \
"SKIP" "Do not install /etc/sendmail.cf" 2> /tmp/reply
 if [ $? = 1 -o $? = 255 ]; then
  rm -f /tmp/reply
  exit
 fi
 SYSTYPE="`cat /tmp/reply`"
 rm -f /tmp/reply
 if [ "$SYSTYPE" = "SMTP+BIND" ]; then
  cp $CONFIGDIR/linux.smtp.cf $T_PX/etc/sendmail.cf
 elif [ "$SYSTYPE" = "SMTP" ]; then
  cp $CONFIGDIR/linux.nodns-smtp.cf $T_PX/etc/sendmail.cf
 elif [ "$SYSTYPE" = "UUCP" ]; then
  cp $CONFIGDIR/linux.uucp.cf $T_PX/etc/sendmail.cf
 fi
else # no color!
 echo
 echo "SENDMAIL CONFIGURATION"
 echo
 echo -n "Would you like to install a sendmail.cf file in /etc ([y]es, [n]o)? "
 read YESNO;
 if [ "$YESNO" = "n" ]; then
  exit
 fi
 echo
 echo "CONFIG FILE (/etc/sendmail.cf) SELECTION"
 echo
 cat << EOF
1 - Systems actually on the Internet (including SLIP/CSLIP/PPP) that use
    a nameserver.

2 - Machines that do not use a domain name server, but are connected by
    ethernet, SLIP, CSLIP, PPP, PLIP, etc. i.e. standalone networks without
    nameservers.

3 - Machines that use UUCP. In this case, you'll have to edit the name of
    the machine you connect to into the /etc/sendmail.cf file manually later.
    You can read README.linux in /usr/src/sendmail for more information.

4 - Do not install a sendmail.cf file. NOTE: You can still find copies of
    all three of the supplied config files in /usr/src/sendmail later on.
    If you installed smailcfg.tgz, you'll also have all the tools needed
    to build a sendmail.cf from scratch. 

EOF
 echo -n "Which choice would you like (1/2/3/4)? "
 read SYSTYPE;
 while [ 0 ] ; do
  if [ "$SYSTYPE" = "1" ]; then
   echo
   echo "Configuring sendmail..."
   cp $CONFIGDIR/linux.smtp.cf $T_PX/etc/sendmail.cf
   break;
  elif [ "$SYSTYPE" = "2" ]; then
   echo
   echo "Configuring sendmail..."
   cp $CONFIGDIR/linux.nodns-smtp.cf $T_PX/etc/sendmail.cf
   break;
  elif [ "$SYSTYPE" = "3" ]; then
   echo
   echo "Configuring sendmail (remember to edit in the remote machine name later)..."
   cp $CONFIGDIR/linux.uucp.cf $T_PX/etc/sendmail.cf
   break;
  elif [ "$SYSTYPE" = "4" ]; then
   echo
   echo "Skipping sendmail configuration..."
   break;
  fi
 done
fi
