]> git.parisson.com Git - docker-django-scripts.git/commitdiff
Just use env variable to select DB mode
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 23 Oct 2017 09:08:16 +0000 (11:08 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 23 Oct 2017 09:08:16 +0000 (11:08 +0200)
db/restore.sh

index 94ba8c37544fe8f07d05695921b26bd61103e681..7d20816e903b339e4f493d27b83c5f3bea1425c5 100755 (executable)
@@ -1,14 +1,14 @@
 #!/bin/bash
 
 # import dump functions of the database (postgres or mysql)
-export POSTGRES="$(dpkg --get-selections  | grep postgres 2>&1)"
-export MYSQL="$(dpkg --get-selections  | grep mysql 2>&1)"
+export POSTGRES="$(dpkg --get-selections  | grep postgres 2>&1)"
+export MYSQL="$(dpkg --get-selections  | grep mysql 2>&1)"
 
-if [ ! -z "$MYSQL" ];
+if [ ! -z "$MYSQL_ROOT_PASSWORD" ];
     then
     export MYSQL_PWD=$MYSQL_ROOT_PASSWORD
     mysql -h db $MYSQL_DATABASE -uroot < /srv/backup/mariadb.dump
-elif [ ! -z "$POSTGRES" ];
+elif [ ! -z "$POSTGRES_PASSWORD" ];
     then
     export PGUSER="postgres"
     export PGPASSWORD=$POSTGRES_PASSWORD