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) # Version majeure de Debian (..., 9, 10)
debian_version=$(cat /etc/debian_version) debian_version=$(cat /etc/debian_version)
debian_version=${debian_version%%.*} debian_version=${debian_version%%.*}
die() {
echo
echo "Erreur: $1"
echo
exit 1
}
# Fix path # Fix path
export PATH="${PATH}":/usr/sbin:/sbin export PATH="${PATH}":/usr/sbin:/sbin
@ -12,7 +18,8 @@ umask 0022
export SCODOC_DIR=/opt/scodoc/Products/ScoDoc 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 # = /opt/scodoc/var/scodoc
export SCODOC_VERSION_DIR="${SCODOC_VAR_DIR}/config/version" export SCODOC_VERSION_DIR="${SCODOC_VAR_DIR}/config/version"
export SCODOC_LOGOS_DIR="${SCODOC_VAR_DIR}/config/logos" export SCODOC_LOGOS_DIR="${SCODOC_VAR_DIR}/config/logos"
@ -24,22 +31,22 @@ export POSTGRES_SUPERUSER=postgres
export POSTGRES_USER=www-data export POSTGRES_USER=www-data
# psql command: if various versions installed, force the one we want: # psql command: if various versions installed, force the one we want:
if [ ${debian_version} = "10" ] if [ "${debian_version}" = "10" ]
then then
PSQL=/usr/lib/postgresql/11/bin/psql PSQL=/usr/lib/postgresql/11/bin/psql
elif [ ${debian_version} = "9" ] elif [ "${debian_version}" = "9" ]
then then
PSQL=/usr/lib/postgresql/9.6/bin/psql PSQL=/usr/lib/postgresql/9.6/bin/psql
elif [ ${debian_version} = "8" ] elif [ "${debian_version}" = "8" ]
then then
PSQL=/usr/lib/postgresql/9.4/bin/psql PSQL=/usr/lib/postgresql/9.4/bin/psql
elif [ ${debian_version} = "7" ] elif [ "${debian_version}" = "7" ]
then then
PSQL=/usr/lib/postgresql/9.1/bin/psql PSQL=/usr/lib/postgresql/9.1/bin/psql
elif [ ${debian_version} = "5" ] elif [ "${debian_version}" = "5" ]
then then
PSQL=/usr/lib/postgresql/8.3/bin/psql PSQL=/usr/lib/postgresql/8.3/bin/psql
elif [ ${debian_version} = "6" ] elif [ "${debian_version}" = "6" ]
then then
PSQL=/usr/lib/postgresql/8.4/bin/psql PSQL=/usr/lib/postgresql/8.4/bin/psql
else else
@ -53,7 +60,7 @@ fi
export POSTGRES_PORT=5432 export POSTGRES_PORT=5432
# Utilise par le script de reset du mot de passe: # Utilise par le script de reset du mot de passe:
if [ ${debian_version} -ge "7" ] if [ "${debian_version}" -ge "7" ]
then then
export ZOPE_VERSION=2.13 export ZOPE_VERSION=2.13
else else