1
0
forked from ScoDoc/ScoDoc

shellcheck

This commit is contained in:
IDK 2021-01-23 17:42:14 +01:00
parent e4168f0786
commit 396880d058

View File

@ -1,8 +1,14 @@
#!/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
@ -12,7 +18,8 @@ umask 0022
export SCODOC_DIR=/opt/scodoc/Products/ScoDoc
export SCODOC_VAR_DIR=$(realpath -L "$SCODOC_DIR/../../var/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"
@ -24,22 +31,22 @@ export POSTGRES_SUPERUSER=postgres
export POSTGRES_USER=www-data
# psql command: if various versions installed, force the one we want:
if [ ${debian_version} = "10" ]
if [ "${debian_version}" = "10" ]
then
PSQL=/usr/lib/postgresql/11/bin/psql
elif [ ${debian_version} = "9" ]
elif [ "${debian_version}" = "9" ]
then
PSQL=/usr/lib/postgresql/9.6/bin/psql
elif [ ${debian_version} = "8" ]
elif [ "${debian_version}" = "8" ]
then
PSQL=/usr/lib/postgresql/9.4/bin/psql
elif [ ${debian_version} = "7" ]
elif [ "${debian_version}" = "7" ]
then
PSQL=/usr/lib/postgresql/9.1/bin/psql
elif [ ${debian_version} = "5" ]
elif [ "${debian_version}" = "5" ]
then
PSQL=/usr/lib/postgresql/8.3/bin/psql
elif [ ${debian_version} = "6" ]
elif [ "${debian_version}" = "6" ]
then
PSQL=/usr/lib/postgresql/8.4/bin/psql
else
@ -53,7 +60,7 @@ fi
export POSTGRES_PORT=5432
# Utilise par le script de reset du mot de passe:
if [ ${debian_version} -ge "7" ]
if [ "${debian_version}" -ge "7" ]
then
export ZOPE_VERSION=2.13
else