feat : Utilisation web disponible et simplification du deployement des scripts (WIP)
This commit is contained in:
@@ -74,23 +74,16 @@ if ! "$SUDO_BIN" -n true >/dev/null 2>&1; then
|
||||
fail "sudo non interactif indisponible pour l'utilisateur courant"
|
||||
fi
|
||||
|
||||
if ! "$SUDO_BIN" -n -u postgres true >/dev/null 2>&1; then
|
||||
fail "sudo -n -u postgres indisponible"
|
||||
fi
|
||||
|
||||
if [[ ! "$PGPORT" =~ ^[0-9]+$ ]]; then
|
||||
fail "PGPORT invalide : $PGPORT"
|
||||
fi
|
||||
|
||||
POSTGRES_INSTALLED="no"
|
||||
|
||||
if ! require_cmd psql || ! require_cmd pg_restore || ! require_cmd createdb || ! require_cmd dropdb; then
|
||||
[[ "${AUTO_INSTALL_POSTGRES,,}" == "yes" ]] || fail "PostgreSQL absent et AUTO_INSTALL_POSTGRES=no"
|
||||
|
||||
log "PostgreSQL absent : installation en cours..."
|
||||
"$SUDO_BIN" -n apt update >/dev/null 2>&1 || fail "échec de apt update"
|
||||
"$SUDO_BIN" -n apt install -y $POSTGRES_PACKAGE_LIST >/dev/null 2>&1 || fail "échec de l'installation PostgreSQL"
|
||||
POSTGRES_INSTALLED="yes"
|
||||
log "Installation PostgreSQL terminée."
|
||||
else
|
||||
log "PostgreSQL déjà installé."
|
||||
@@ -140,6 +133,10 @@ if [[ "${AUTO_CREATE_PGUSER,,}" == "yes" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! "$SUDO_BIN" -n -u postgres true >/dev/null 2>&1; then
|
||||
fail "sudo -n -u postgres indisponible"
|
||||
fi
|
||||
|
||||
if ! psql -h "$PGHOST" -p "$PGPORT" -U "$PGUSER" -d postgres -c "SELECT 1;" >/dev/null 2>&1; then
|
||||
fail "connexion PostgreSQL locale impossible avec PGUSER=${PGUSER}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user