1
0
forked from ScoDoc/ScoDoc
ScoDoc/config/config.sh
2021-01-23 17:42:14 +01:00

69 lines
1.8 KiB
Bash

#!/bin/bash
# Version majeure de Debian (..., 9, 10)
debian_version=$(cat /etc/debian_version)
debian_version=${debian_version%%.*}
die() {
echo
echo "Erreur: $1"
echo
exit 1
}
# Fix path
export PATH="${PATH}":/usr/sbin:/sbin
# ScoDoc: environment variables
umask 0022
export SCODOC_DIR=/opt/scodoc/Products/ScoDoc
SCODOC_VAR_DIR=$(realpath -L "$SCODOC_DIR/../../var/scodoc") || die "can't set SCODOC_VAR_DIR"
export SCODOC_VAR_DIR
# = /opt/scodoc/var/scodoc
export SCODOC_VERSION_DIR="${SCODOC_VAR_DIR}/config/version"
export SCODOC_LOGOS_DIR="${SCODOC_VAR_DIR}/config/logos"
# Postgresql superuser:
export POSTGRES_SUPERUSER=postgres
# Postgresql normal user: (by default, same a zope==www-data)
# IMPORTANT: must match SCO_DEFAULT_SQL_USER defined in sco_utils.py
export POSTGRES_USER=www-data
# psql command: if various versions installed, force the one we want:
if [ "${debian_version}" = "10" ]
then
PSQL=/usr/lib/postgresql/11/bin/psql
elif [ "${debian_version}" = "9" ]
then
PSQL=/usr/lib/postgresql/9.6/bin/psql
elif [ "${debian_version}" = "8" ]
then
PSQL=/usr/lib/postgresql/9.4/bin/psql
elif [ "${debian_version}" = "7" ]
then
PSQL=/usr/lib/postgresql/9.1/bin/psql
elif [ "${debian_version}" = "5" ]
then
PSQL=/usr/lib/postgresql/8.3/bin/psql
elif [ "${debian_version}" = "6" ]
then
PSQL=/usr/lib/postgresql/8.4/bin/psql
else
PSQL=/usr/lib/postgresql/8.1/bin/psql
fi
# tcp port for SQL server (under Debian 4, 5432 or 5433 for 8.1 if 7.4 also installed !)
# Important note: if changed, you should probably also change it in
# sco_utils.py (SCO_DEFAULT_SQL_PORT).
export POSTGRES_PORT=5432
# Utilise par le script de reset du mot de passe:
if [ "${debian_version}" -ge "7" ]
then
export ZOPE_VERSION=2.13
else
export ZOPE_VERSION=2.11.0
fi