#!/bin/sh
# Simple shell script to simplify necessary additions to files
if test ! -r eggdrop; then
  echo ""
  echo "You don't seem to be in the eggdrop directory."
  echo -n "Do you still wish to proceed (Y/N)? "
  read yn
  if test "$yn" != "y"; then
    exit 1
  fi
fi

echo ""
echo "Setting up MadHack's Tewlz, version 2.0 by MadHack <madhack@pobox.com>"
echo ""
echo ""
echo "You may like to start this script when your bot starts up."
echo -n "    Would you like to set this up (Y/N)? "
read yn
if test "$yn" = "y"; then
  echo ""
  echo "Please enter the name of the config file that this will run from:"
  echo -n "    "
  read config
  if test ! -w $config; then
    echo ""
    echo "Error: the file $config does not exist or you do not have write"
    echo "permission on it. Please run again and specify a valid, writable"
    echo "file."
    echo ""
    exit 1
  else
    echo ""
    echo "Adding source to '$config' . . ."
    echo "source scripts/madhack.tcl" >>$config
  fi
else
  echo ""
  echo "Skipping modification of config file. . ."
fi
echo ""
echo "You may also add the new commands to the main help file."
echo -n "    Do you wish to do this (Y/N)? "
read yn
if test "$yn" = "y"; then
  echo ""
  echo "Adding new information to help file . . ."
  echo "%(These commands added by MadHack's Tewlz:%)" >>help/dcc.help
  echo "%(  time         date         gmt%)" >>help/dcc.help
  echo "%[  +chan        -chan        chchan       anounce%]" >>help/dcc.help
  echo "%[  isolate      merge%]" >>help/dcc.help
else
  echo ""
  echo "Skipping help file additions . . ."
fi
echo ""
echo ""
echo "Selected modifications are now complete."
echo ""
