From 42ac9031e671a24697f5e95af982325689d8b906 Mon Sep 17 00:00:00 2001 From: Midgard Date: Fri, 17 Jul 2020 11:10:05 +0200 Subject: [PATCH] Avoid overwriting config, make DB script robuster --- first-setup.sh | 10 ++++++---- populate-db.sh | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/first-setup.sh b/first-setup.sh index 868db65..a2e7c52 100755 --- a/first-setup.sh +++ b/first-setup.sh @@ -30,10 +30,12 @@ else echo "Not installing airbrake" fi -echo -e "${B} Copying config template. All custom config options can be set in the config.py file ${E}" -cd app -cp config.example.py config.py -cd .. +if [ ! -f app/config.py ]; then + echo -e "${B} Copying config template. All custom config options can be set in the config.py file ${E}" + cp app/config.example.py app/config.py +else + echo -e "${B} Found existing config.py, not copying config teplate ${E}" +fi echo -e "${B} Seeding database ${E}" ./populate-db.sh diff --git a/populate-db.sh b/populate-db.sh index 800b53b..400ce2e 100755 --- a/populate-db.sh +++ b/populate-db.sh @@ -1,7 +1,7 @@ #!/bin/bash set -euo pipefail -cd app +cd "$(dirname "$0")/app" cp database/* . -python create_database.py setup_database -rm -f add_* create_database.py muhscheme +../venv/bin/python create_database.py setup_database +rm -f add_* create_database.py muhscheme.txt