#
# Copyright (C) 2003 VA Linux Systems Japan, K.K.
#
# LICENSE NOTICE
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#                                                                     
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#

# $Id: modules.in,v 1.53 2004/10/29 18:38:54 taru Exp $

if test "x$ULTRAPOSSUM_DEBUG" != "x"; then
  set -x
fi

prefix=${prefix:-/usr}
exec_prefix=${exec_prefix:-${prefix}}
localstatedir=${localstatedir:-/var}
datadir=${datadir:-${prefix}/share}
libdir=${libdir:-${exec_prefix}/lib}
sysconfdir=${sysconfdir:-/etc}
ldapconfdir=${ldapconfdir:-/etc/ldap}
ldaplibexecdir=${ldaplibexecdir:-/usr/sbin}
ldapdatadir=${ldapdatadir:-/usr/share/ldap}
ldaplibdir=${ldaplibdir:-/usr/lib/ldap}
ldapsysconfdir=${ldapsysconfdir:-/etc/ldap}
hasysconfdir=${hasysconfdir:-/etc/ha.d}
halocalstatedir=${halocalstatedir:-/var}
monlibdir=${monlibdir:-/usr/lib/mon}
monsysconfdir=${monsysconfdir:-/etc/mon}
sudoersdir=${sudoersdir:-/etc}
opensslsysconfdir=${opensslsysconfdir:-/etc/ssl}
ldaplistenport=${ldaplistenport:-}
ldapslistenport=${ldapslistenport:-}
monpidfile=${monpidfile:-/var/run/mon/mon.pid}

PACKAGE=${PACKAGE:-ultrapossum}
VERSION="1.0rc5"
CONFARGS="/tmp/buildd/ultrapossum-1.0rc5/./configure --build=i386-linux --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --libexecdir=${prefix}/lib/ultrapossum --srcdir=. --disable-maintainer-mode --with-modules=client,server,test,startTLS,dnsbalance,failover --with-ldaplibexecdir=/usr/sbin --with-ldapsysconfdir=/etc/ldap --with-ldapdatadir=/usr/share/ldap --with-ldaplibdir=/usr/lib/ldap --with-hasysconfdir=/etc/ha.d --with-monlibdir=/usr/lib/mon --with-monsysconfdir=/etc/mon --with-monpiddir=/var/run/mon --with-halocalstatedir=/var --with-sudoersdir=/etc --with-opensslsysconfdir=/etc/ssl"
CACHEDIR=${CACHEDIR:-$localstatedir/cache/ultrapossum}

# Directory Definition
SHAREDIR=${SHAREDIR:-${prefix}/share/${PACKAGE}}
TESTDIR=${TESTDIR:-${libdir}/${PACKAGE}/test}
TESTSCRIPTSDIR=${TESTSCRIPTSDIR:-${TESTDIR}/test.d}
CONFDIR=${CONFDIR:-${localstatedir}/lib/${PACKAGE}/conf.d/${ULTRAPOSSUM_PROJECT}}
APPSDIR=${APPSDIR:-${SHAREDIR}/apps.d}
MODULEDIR=${MODULEDIR:-${SHAREDIR}/module.d}
UPDATEDIR=${UPDATEDIR:-${SHAREDIR}/update.d}
BACKUPDIR=${BACKUPDIR:-${localstatedir}/backups/${PACKAGE}}
SYSCONFDIR=${SYSCONFDIR:-${sysconfdir}/${PACKAGE}}
APPSCONFDIR=${APPSCONFDIR:-${SYSCONFDIR}/apps}
TEMPLATEDIR=${TEMPLATEDIR:-${SYSCONFDIR}/in.d}
MODULECONFDIR=${MODULECONFDIR:-${SYSCONFDIR}/module.d}
SSHKEYDIR=${SSHKEYDIR:-${SYSCONFDIR}/ssh}

CONFSTATUS=${CONFSTATUS:-$CONFDIR/status}
ULTRAPOSSUMCF=${ULTRAPOSSUMCF:-$SYSCONFDIR/ultrapossum.cf}

ULTRAPOSSUM_CONFIG_BACKEND=${ULTRAPOSSUM_CONFIG_BACKEND:-shell}

# loading cache data
if test "x$cache" != "x"; then
  if test "x$ULTRAPOSSUMDEFAULT" != "x"; then
    cache=""
  elif ! test -O "$CACHEDIR/$cache"; then
    if test -f "$CACHEDIR/$cache"; then
      echo "W: cache is owned by another uid: $CACHEDIR/$cache" 1>&2
    fi
    cache=""
  else
    . $CACHEDIR/$cache
  fi
fi

# load initialization plugin
for f in `/bin/ls $SHAREDIR/init.d | sort`
do
  . $SHAREDIR/init.d/$f
done

# storing cache
if test "x$cache" = "x" && test "x$ULTRAPOSSUMDEFAULT" = "x"; then
  if ! test -d "$CACHEDIR"; then
    install -d $CACHEDIR
  fi
  echo "# generated by $0" > $CACHEDIR/$$
  chmod 640 $CACHEDIR/$$
  getconfig >> $CACHEDIR/$$
  export cache="$$"
fi
