forked from ScoDoc/ScoDoc
Fix script mode and add safety check
This commit is contained in:
parent
c0f5292db8
commit
fc59018688
@ -5,12 +5,24 @@
|
|||||||
#
|
#
|
||||||
# $db_name is passed as an environment variable
|
# $db_name is passed as an environment variable
|
||||||
|
|
||||||
source config.sh
|
die() {
|
||||||
source utils.sh
|
echo
|
||||||
|
echo "Erreur: $1"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
echo 'Creating postgresql database'
|
source config.sh || die "config.sh not found, exiting"
|
||||||
|
source utils.sh || die "config.sh not found, exiting"
|
||||||
|
|
||||||
|
if [ "$db_name" == "" ]
|
||||||
|
then
|
||||||
|
echo "Error: env var db_name unset"
|
||||||
|
echo "(ce script ne doit pas être lancé directement !)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
echo 'Creating postgresql database ' $db_name
|
echo 'Creating postgresql database ' "$db_name"
|
||||||
createdb -E UTF-8 -p $POSTGRES_PORT -O $POSTGRES_USER $db_name
|
createdb -E UTF-8 -p "$POSTGRES_PORT" -O "$POSTGRES_USER" "$db_name"
|
||||||
|
|
||||||
|
0
tools/create_users_database.sh
Normal file → Executable file
0
tools/create_users_database.sh
Normal file → Executable file
Loading…
Reference in New Issue
Block a user