#!/bin/sh
T_PX=$1
if [ "$COLOR" = "on" -o -r /tmp/SeTcolor ]; then
 dialog --title "FTAPE CONFIGURATION" --yesno \
"You seem to have installed the FTAPE package on your system. \
The FTAPE module allows the use of a QIC-40 or QIC-80 floppy \
controller tape drive with Linux. If you like, this module can be \
loaded for you at boot time. If you don't have a floppy tape drive, \
you won't need this module. Would you like to load the FTAPE \
module at boot time?" 10 70
 if [ $? = 0 ]; then
  if fgrep "FTAPE" $T_PX/etc/rc.d/rc.local 1> /dev/null 2> /dev/null ; then
   echo > /dev/null
  else
   echo "# Loading FTAPE module" >> $T_PX/etc/rc.d/rc.local
   echo 'echo "Loading FTAPE module..."' >> $T_PX/etc/rc.d/rc.local
   echo "/sbin/insmod -f /boot/ftape.o" >> $T_PX/etc/rc.d/rc.local
  fi
  if fgrep "ftape" $T_PX/etc/profile 1> /dev/null 2> /dev/null ; then
   echo > /dev/null
  else
   echo 'export TAPE="/dev/nftape"' >> $T_PX/etc/profile
  fi
  if fgrep "ftape" $T_PX/etc/csh.cshrc 1> /dev/null 2> /dev/null ; then
   echo > /dev/null
  else
   echo 'set TAPE=/dev/nftape' >> /etc/csh.cshrc
  fi
 fi
else # no color!
 cat << EOF
FTAPE CONFIGURATION

You seem to have installed the FTAPE package on your system. The FTAPE module
allows the use of a QIC-40 or QIC-80 floppy controller tape drive with Linux.
If you like, this module can be loaded for you at boot time. If you don't have
a floppy tape drive, you won't need this module.

EOF
 echo -n "Would you like to load the FTAPE module at boot time ([y]es, [n]o)? "
 while [ 0 ]; do
  read SL;
  if [ "$SL" = "y" ]; then
   echo
   echo "Configuring FTAPE support..."
   if fgrep "FTAPE" $T_PX/etc/rc.d/rc.local 1> /dev/null 2> /dev/null ; then
    echo > /dev/null
   else
    echo "# Loading FTAPE module" >> $T_PX/etc/rc.d/rc.local
    echo 'echo "Loading FTAPE module..."' >> $T_PX/etc/rc.d/rc.local
    echo "/sbin/insmod -f /boot/ftape.o" >> $T_PX/etc/rc.d/rc.local
   fi
   if fgrep "ftape" $T_PX/etc/profile 1> /dev/null 2> /dev/null ; then
    echo > /dev/null
   else
    echo 'export TAPE="/dev/nftape"' >> $T_PX/etc/profile
   fi
   if fgrep "ftape" $T_PX/etc/csh.cshrc 1> /dev/null 2> /dev/null ; then
    echo > /dev/null
   else
    echo 'set TAPE=/dev/nftape' >> /etc/csh.cshrc
   fi
   echo
   break;
  elif [ "$SL" = "n" ]; then
   echo
   break;
  fi
  echo
  echo "Unknown response. Answer y or n."
 done
fi
