cd $SOURCE_DIRECTORY &&
default_install &&

if is_depends_enabled $SPELL openssl; then
  cd contrib/pgcrypto &&
  default_install
fi &&

if is_depends_enabled $SPELL libxml2; then
  cd ../xml2 &&
  default_install
fi &&

if [[ ! -d $PGSQL_DBPATH ]]; then
  install -vm 755 -o postgres -g postgres -d $PGSQL_DBPATH
fi &&

touch $INSTALL_ROOT/var/log/postgres &&
chown postgres:postgres $INSTALL_ROOT/var/log/postgres &&

if is_depends_enabled $SPELL openssl && ! [[ ! -e $PGSQL_DBPATH/server.crt ]]; then
  message "${MESSAGE_COLOR}"
  message "Please place server key and certificate files server.key "
  message "and server.crt into $PGSQL_DBPATH/var/lib/postgres/data. See more about"
  message "it at http://www.postgresql.org/docs/8.3/static/ssl-tcp.html"
  message "${DEFAULT_COLOR}"
fi
