# 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  &&

if [ "$LOC" == "" ]; then
  message  "${MESSAGE_COLOR}Unable to find apache or apache2 installed"  \
           "$SPELL cast aborded.${DEFAULT_COLOR}"                        &&
  return 1
fi  &&

mkdir  -p $LOC           &&
mkdir  -p $LOC/users     &&
mkdir  -p $LOC/sessions  &&
mkdir  -p $LOC/uploads   &&
mkdir  -p $LOC/cache     &&

cp  -r  IlohaMail/*  $LOC  &&

chmod  700  $LOC/users  $LOC/sessions  $LOC/uploads  $LOC/cache  &&
chown  www-data.www-data  -R  $LOC                               &&

# Copy software Documentation
mkdir  -p  /usr/doc/$SPELL       &&
cp  -r  Manual  /usr/doc/$SPELL
