#!/bin/sh

if [ "$2" != "POST-INSTALL" ]; then
  exit 0
fi

bg=gaulle@idris.fr 
tmp=/tmp/mltex_mail.$$
OS=`uname -sr`
email=$USER@`hostname`.`domainname`

echo -n "Do you want to fill the installation report form ? [y] "
read answ; if [ "$answ" = "" ]; then answ=y; fi
case $answ in
  y*|Y*)
  echo -n '# of users for the "french" style ? ';  read nusers
  echo -n "your name: " ; read name
  echo -n "your email address [$email] "; read a; if [ X$a = X ]; then a=$email; fi; email=$a
  echo -n "your organization: " ; read org
  echo -n "your address (1 line!): " ; read address
  ;;
  *) answ=n;;
esac

cat > $tmp <<EOF
                   French style files, installation report form
                   --------------------------------------------

      I've just installed the french style files which have been checked 
to work in my environment.
      I would be pleased to be recorded for free user assistance.

I) Initex made with
===================
kbconfig.tex      : Yes
hyconfig.tex      : Yes with default font encoding : OT1
language.dat      : Yes
keyboard.dat      : Yes

Translators generated
=====================
kb7to8, kb8to7    : Yes

Running (La)TeX with
====================
french.sty V3.35  : Yes
pmfrench.sty      : No
language.dat      : Yes
keyboard.sty &
keyboard.dat      : Yes
kb7to8, kb8to7    : Yes

My environment is
=================
MACHINE type      : PC
  Operating system: $OS
# of (La)TeX users: $nusers
TeX engine
        name      : MlTeX
        version   : 2.01/3.1415
Input/Output Filter: No
Input Encoding    : ISO 8859-1
Font Encoding type:  CMR
Package used      : LaTeX
Specific Styles   : ?
Previewer         : ?
Printers          : ?

My address is (don't communicate to any third part)
=============

Name: $name
Organisation: $org
Address: $address

Email: $email
Phone:
Fax:

II) Other comments:
===================
This is the FreeBSD ports/printing/mltex package

EOF

if [ $answ = y ]; then
  echo -n "Do you want to read the installation report? [y] "
  read answ; if [ "$answ" = "" ]; then answ=y; fi
  if [ $answ = y ]; then cat $tmp; fi
  echo 
  echo 
  echo -n "Ok to send the report to the author? [y] "
  read answ; if [ "$answ" = "" ]; then answ=y; fi
  if [ $answ = y ]; then
    mail -s "(french) installation" $bg < $tmp 
    echo "report has been sent. You can remove it ($tmp)."
  else
    answ=n
  fi
fi
if [ $answ = n ]; then
  echo report not filled, but left in $tmp.
  echo You can edit it and send it to $bg
fi
exit 0


