améliore check_create_scodoc_user pour set -e (contrib JMP)

This commit is contained in:
Emmanuel Viennet 2021-08-17 12:18:42 +02:00
parent e8c20f7005
commit 027237c1c6
3 changed files with 4 additions and 5 deletions

View File

@ -38,7 +38,7 @@ export SCODOC_DB_TEST="SCODOC_TEST"
# 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}" = "11" ]
then then
PSQL=/usr/lib/postgresql/11/bin/psql PSQL=/usr/lib/postgresql/11/bin/psql
export POSTGRES_SERVICE="postgresql@11-main.service" export POSTGRES_SERVICE="postgresql@11-main.service"

View File

@ -21,7 +21,7 @@ check_uid_root "$0"
cd "$SCODOC_DIR" || die "can't cd $SCODOC_DIR" cd "$SCODOC_DIR" || die "can't cd $SCODOC_DIR"
# ------------ Safety checks # ------------ Safety checks
if [ "${debian_version}" != "10" ] if [ "${debian_version}" != "11" ]
then then
echo "Version du systeme Linux Debian incompatible" echo "Version du systeme Linux Debian incompatible"
exit 1 exit 1
@ -70,7 +70,7 @@ python3 -m venv venv || die "can't create Python 3 virtualenv"
# ------------ INSTALL DES PAQUETS PYTHON (3.7) # ------------ INSTALL DES PAQUETS PYTHON (3.7)
# ScoDoc8 uses pip in our env # ScoDoc8 uses pip in our env
source venv/bin/activate source venv/bin/activate
pip install --upgrade pip # pip install --upgrade pip => bug [Errno 39] Directory not empty: '_internal'
pip install wheel pip install wheel
pip install -r requirements-3.7.txt pip install -r requirements-3.7.txt

View File

@ -61,8 +61,7 @@ init_postgres_user() { # run as root
# --- Ensure Unix user "scodoc" exists # --- Ensure Unix user "scodoc" exists
check_create_scodoc_user() { check_create_scodoc_user() {
id -u "${SCODOC_USER}" &> /dev/null if ! id -u "${SCODOC_USER}" &> /dev/null
if [ "$?" != 0 ]
then then
echo "Creating unix user ${SCODOC_USER}" echo "Creating unix user ${SCODOC_USER}"
adduser --no-create-home --shell /bin/bash --gecos "ScoDoc service" "${SCODOC_USER}" || die "failed to create user" adduser --no-create-home --shell /bin/bash --gecos "ScoDoc service" "${SCODOC_USER}" || die "failed to create user"