From 396880d0586f78d30aac2a4605a51e7ff0124c7a Mon Sep 17 00:00:00 2001 From: IDK Date: Sat, 23 Jan 2021 17:42:14 +0100 Subject: [PATCH] shellcheck --- config/config.sh | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/config/config.sh b/config/config.sh index ab9dccb..07f684c 100644 --- a/config/config.sh +++ b/config/config.sh @@ -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