ScoDoc-PE/tools/config.sh

51 lines
1.3 KiB
Bash
Raw Normal View History

2020-12-19 19:22:22 +01:00
#!/bin/bash
2020-09-26 16:19:37 +02:00
# Version majeure de Debian (..., 9, 10)
debian_version=$(cat /etc/debian_version)
debian_version=${debian_version%%.*}
2021-01-23 17:42:14 +01:00
die() {
echo
echo "Erreur: $1"
echo
exit 1
}
2020-09-26 16:19:37 +02:00
# Fix path
export PATH="${PATH}":/usr/sbin:/sbin
# ScoDoc: environment variables
umask 0022
export SCODOC_DIR=/opt/scodoc8
2020-12-06 15:28:49 +01:00
SCODOC_VAR_DIR=$(realpath -L "$SCODOC_DIR/var") || die "can't set SCODOC_VAR_DIR"
2021-01-23 17:42:14 +01:00
export SCODOC_VAR_DIR
2020-09-26 16:19:37 +02:00
# = /opt/scodoc/var/scodoc
export SCODOC_VERSION_DIR="${SCODOC_VAR_DIR}/config/version"
export SCODOC_LOGOS_DIR="${SCODOC_VAR_DIR}/config/logos"
# user running ScoDoc server:
export SCODOC_USER=scodoc
export SCODOC_GROUP=root
# Postgresql normal user: (same as unix user)
2020-09-26 16:19:37 +02:00
# IMPORTANT: must match SCO_DEFAULT_SQL_USER defined in sco_utils.py
export POSTGRES_USER="$SCODOC_USER"
# Postgresql superuser:
export POSTGRES_SUPERUSER=postgres
2020-09-26 16:19:37 +02:00
# psql command: if various versions installed, force the one we want:
2020-12-19 19:22:22 +01:00
if [ "${debian_version}" = "10" ]
2020-09-26 16:19:37 +02:00
then
PSQL=/usr/lib/postgresql/11/bin/psql
export POSTGRES_SERVICE="postgresql@11-main.service"
else
die "unsupported Debian version"
2020-09-26 16:19:37 +02:00
fi
2020-12-19 19:22:22 +01:00
export PSQL
2020-09-26 16:19:37 +02:00
# 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