OUTPUT_FILE="/etc/httpd/httpd.conf"
I_SIGNATURE="Alias /webmail/"

# apache htdoc path auto detection
if  spell_ok    "apache";   then
  LOC="/usr/share/httpd/htdocs/$SPELL"
elif  spell_ok  "apache-mod_ssl";  then
  LOC="/usr/share/httpsd/htdocs/$SPELL"
elif  spell_ok  "apache2";  then
  LOC="/usr/share/apache2/htdocs/$SPELL"
fi  &&

grep  "$I_SIGNATURE"  $OUTPUT_FILE  1>/dev/null  2>&1

if [ $? -eq 0 ] && [ -e "$OUTPUT_FILE" ]; then
  message "${MESSAGE_COLOR}$SPELL signature found in $OUTPUT_FILE. ${DEFAULT_COLOR}"
  message "${MESSAGE_COLOR}$OUTPUT_FILE update skiped. ${DEFAULT_COLOR}"
else
  message "${MESSAGE_COLOR}Updating $OUTPUT_FILE ${DEFAULT_COLOR}"
  cp /etc/httpd/httpd.conf /etc/httpd/httpd.conf.$SPELL.backup

  echo " "                                                     >> /etc/httpd/httpd.conf
  echo "### This line was generated by $SPELL cast ###"        >> /etc/httpd/httpd.conf
  echo "$I_SIGNATURE \"$LOC/source\""                          >> /etc/httpd/httpd.conf
  echo " "                                                     >> /etc/httpd/httpd.conf
fi
