From 54965516341c2d75382442ac38efe40384239a2c Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sun, 10 Jul 2022 08:00:31 +0200 Subject: [PATCH] Update run.sh --- wger/rootfs/run.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/wger/rootfs/run.sh b/wger/rootfs/run.sh index 11ea87383..885b3fc4a 100644 --- a/wger/rootfs/run.sh +++ b/wger/rootfs/run.sh @@ -6,13 +6,21 @@ sed -i "s|/usr/bin/with-contenv|/usr/bin/env|g" /etc/cont-init.d/* LOCATION=/data mkdir -p "$LOCATION" -touch "$LOCATION"/database.sqlite || true -chown -R wger "$LOCATION" || true -chmod -R 777 "$LOCATION" || true + +if [ ! -f "$LOCATION"/database.sqlite ]; then + if [ -f "/home/wger/db/database.sqlite" ]; then + cp /home/wger/db/database.sqlite "$LOCATION"/database.sqlite + else + touch "$LOCATION"/database.sqlite + fi +fi + +chown -R wger "$LOCATION" +chmod -R 777 "$LOCATION" rm /home/wger/db/database.sqlite &>/dev/null || true ln -s "$LOCATION"/database.sqlite /home/wger/db python3 manage.py migrate || true echo "Launch app" -su -m -l wger -c "cd /home/wger/src && export FROM_EMAIL='wger Workout Manager ' && exec /home/wger/entrypoint.sh" +su -l wger -c "cd /home/wger/src && export FROM_EMAIL='wger Workout Manager ' && exec /home/wger/entrypoint.sh"