#!/bin/bash

#----------------------------------------------------------------------------#
#   Qmail The Easy Way v1.3 - distributed under the General Public License   #
#                                README                                      #
#                          September 5, 2001                                 #
#----------------------------------------------------------------------------#

#Declaring global Variables
ans1=y
ans2=Y
ans3=n
ans4=N

start ( )
 {
  clear
  echo " "
  echo " "
  echo "                 +++++++++++++++++++++++++++++++++++++"
  echo "                      Welcome to Qmail The Easy Way      "
  echo "                 +++++++++++++++++++++++++++++++++++++"
  echo "  "
  echo "  --> This script is distributed under the auspices of the GNU/GPL."
  echo " " 
  echo "  --> This script will wipe out ONLY the qmail(smtp+pop) installation "
  echo "      from the disk."
  echo "  --> !!! Better be carefull while running this script !!!." 
  echo " "
  echo  "                                   Trevor Warren "
  echo  "                               thefreeosguy@yahoo.com    "
  sleep 10
  echo " "
  echo " "
 }

stop ( )
 {
  echo " "
  echo " "
  echo "          +++++++++++++++++++++++++++++++++++++++"
  echo "            Thanks for using Qmail The Easy Way     "
  echo "          +++++++++++++++++++++++++++++++++++++++"
  echo " "
  echo " "
 }

qmail_remove ( )
 {
 echo  "  --> Delete the Qmail Installation directories..../var/qmail.  "
 echo  "      Y or N."
 read answer1
   if [ $answer1 = $ans1 -o $answer1 = $ans2 ]
    then
     rm -fr /var/qmail 
     rm -fr /service/qmail-pop3d
     rm -fr /service/qmail-send
     rm -fr /service/qmail-smtpd 
     echo " "
     echo "  --> Deleted Qmail from /var/qmail and also entries from /service."
     echo " "
     echo "  --> To prevent any of DJB's services from running ......"
     echo "  --> Edit /etc/inittab and comment out the last line "
     echo "      SV:123456:respawn:/command/svscanboot from the file."
     echo " " 
     echo "  --> Edit /etc/resolv.conf and remove and local nameserver entries."
     echo " "
    else
     echo " "
     echo "  --> Left Qmail installation from /var/qmail intact."
     echo " "
  fi
 }


start
qmail_remove
stop
